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

Eric Milles closed GROOVY-8724.
-------------------------------
    Resolution: Duplicate

> 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
>            Reporter: Markov Alexey
>            Priority: Major
>              Labels: ClassFormatError
>
> 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
(v8.20.7#820007)

Reply via email to