groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markov Alexey (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (GROOVY-8724) Groovy static methods with dots causes compilation error
Date Thu, 16 Aug 2018 13:56:00 GMT

     [ https://issues.apache.org/jira/browse/GROOVY-8724?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Markov Alexey updated GROOVY-8724:
----------------------------------
    Affects Version/s: 2.5.2

> Groovy static methods with dots causes compilation error
> --------------------------------------------------------
>
>                 Key: GROOVY-8724
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8724
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.15, 2.5.2
>         Environment: Linux 16.04 Java 1.8.0_171 IDEA Community Edition 2018.1.6
>            Reporter: Markov Alexey
>            Priority: Major
>
> I have a problem with methods that have dots in their name. Here's a code example
>  
> {code:java}
> class SomeList {
>     SomeList(String field) {
>     }
>     static SomeList "Regular name of method"() {
>         println("regular method")
>     }
>     static SomeList "Name with.dot"() {
>         println("method with dot")
>     }
> }
> {code}
> and i have test for it which cause compilation error:
>  
>  
> {code:java}
> class SomeListTests {
>     @Test
>     def "some list test"() {
>         //given
>         SomeList list = new SomeList()
>         //when
>         list."Regular name of method"()
>         //then
>         //compilation error
>     }
> }
> {code}
> Even if i run it in IDEA or with ./gradlew test it crashes with error:
>  
>  
> {code:java}
> Error:Groovyc: While compiling tests of example-project_test: BUG! exception in phase
'semantic analysis' in source unit '/home/alex/Projects/example-project/src/test/groovy/SomeListTests.groovy'
Problem loading class SomeList
> at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:970)
> ... and so on i can drop all at comments{code}
> BUT if i run Groovy script like this:
>  
> Script:
>  
> {code:java}
> SomeList."Regular name of method"()
> SomeList."Name with.dot"()
> {code}
> Run:
>  
>  
> {code:java}
> class Main {
>     public static void main(String[] args) {
>         GroovyShell shell = new GroovyShell()
>         shell.run(new File("""pathToFile/Script.groovy"""), Collections.emptyList())
>         println "Everything is cool"
>     }
> }
> {code}
> I have everything perfect:
>  
> {code:java}
> regular method
> method with dot
> Everything is cool
> {code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message