You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2019/05/26 14:39:00 UTC
[jira] [Commented] (GROOVY-9146) Seems to be a gap in method
reference support
[ https://issues.apache.org/jira/browse/GROOVY-9146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16848453#comment-16848453 ]
Daniel Sun commented on GROOVY-9146:
------------------------------------
We should fix the issue
> Seems to be a gap in method reference support
> ---------------------------------------------
>
> Key: GROOVY-9146
> URL: https://issues.apache.org/jira/browse/GROOVY-9146
> Project: Groovy
> Issue Type: Bug
> Reporter: Paul King
> Priority: Major
>
> With the class definition, it appears to produce the correct output:
> {code}
> @groovy.transform.CompileStatic
> class Foo {
> static void main(args) {
> Function<String, String> lower = String::toLowerCase
> println "lower = $lower" // => Foo$$Lambda$14/0x0000000801205040@7bd4937b
> }
> }
> {code}
> Removing to make it a script method gives:
> {code}
> @groovy.transform.CompileStatic
> //class Foo {
> static void main(args) {
> Function<String, String> lower = String::toLowerCase
> println "lower = $lower" // => org.codehaus.groovy.runtime.MethodClosure@4cdd2c73
> }
> //}
> {code}
> 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.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)