Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
2.4.15, 2.5.2
-
None
-
None
Description
I have a problem with methods that have dots in their name. Here's a code example
class SomeList { SomeList(String field) { } static SomeList "Regular name of method"() { println("regular method") } static SomeList "Name with.dot"() { println("method with dot") } }
and i have test for it which cause compilation error:
class SomeListTests { @Test def "some list test"() { //given SomeList list = new SomeList() //when list."Regular name of method"() //then //compilation error } }
Even if i run it in IDEA or with ./gradlew test it crashes with error:
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
BUT if i run Groovy script like this:
Script:
SomeList."Regular name of method"() SomeList."Name with.dot"()
Run:
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" } }
I have everything perfect:
regular method method with dot Everything is cool
Attachments
Issue Links
- duplicates
-
GROOVY-2857 Full support for special characters in method names
- Open