You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2020/11/11 02:02:05 UTC

[jira] [Closed] (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:all-tabpanel ]

Paul King closed GROOVY-9146.
-----------------------------

> 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
>            Assignee: Paul King
>            Priority: Major
>             Fix For: 4.0.0-alpha-1, 3.0.6
>
>
> 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
(v8.3.4#803005)