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 2019/07/22 04:22:02 UTC

[jira] [Closed] (GROOVY-9131) Extension method support for native method references

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

Paul King closed GROOVY-9131.
-----------------------------

> Extension method support for native method references
> -----------------------------------------------------
>
>                 Key: GROOVY-9131
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9131
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Paul King
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 3.0.0-beta-2
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> The following two method reference statements compile and execute successfully with and without @CS (and with CS produce the correct native bytecode):
> {code}
> assert 'Hi'.transform(String::length) == 2 // transform is JDK12
> assert 'Hi'.transform(StringGroovyMethods::size) == 2
> {code}
> This statement (using the extension method from StringGroovyMethods) works for dynamic Groovy:
> {code}
> assert 'Hi'.transform(String::size) == 2
> {code}
> But for static Groovy fails compilation with:
> {noformat}
> 1 compilation error:
> org.codehaus.groovy.syntax.RuntimeParserException: Failed to find the expected method[size(java.lang.String)] in the type[java.lang.String]
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)