Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
With the class definition, it appears to produce the correct output:
@groovy.transform.CompileStatic class Foo { static void main(args) { Function<String, String> lower = String::toLowerCase println "lower = $lower" // => Foo$$Lambda$14/0x0000000801205040@7bd4937b } }
Removing to make it a script method gives:
@groovy.transform.CompileStatic //class Foo { static void main(args) { Function<String, String> lower = String::toLowerCase println "lower = $lower" // => org.codehaus.groovy.runtime.MethodClosure@4cdd2c73 } //}
I don't know whether it is a gap in method reference handling or does the @CompileStatic annotation get lost on the special script main method when we override. Still to be investigate but we either need to fix or document.