[jira] [Resolved] (GROOVY-8493) Native lambdas with @CompileStatic at method level

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Resolved] (GROOVY-8493) Native lambdas with @CompileStatic at method level

JIRA jira@apache.org

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

Daniel Sun resolved GROOVY-8493.
--------------------------------
       Resolution: Fixed
    Fix Version/s: 2.6.0-alpha-4
                   3.0.0-alpha-2

Fixed by: https://github.com/apache/groovy/commit/3f41484e512a196149b9ec26e39958a436df56c4

> Native lambdas with @CompileStatic at method level
> --------------------------------------------------
>
>                 Key: GROOVY-8493
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8493
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.6.0-alpha-3
>            Reporter: Paul King
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 3.0.0-alpha-2, 2.6.0-alpha-4
>
>
> This code:
> {code}
> import groovy.transform.CompileStatic
> import java.util.stream.Collectors
> @CompileStatic
> class Main {
>     static void main(String[] args) {
>         assert [2, 3, 4] == [1, 2, 3].stream().map(e -> e.plus 1).collect(Collectors.toList())
>     }
> }
> {code}
> works and produces a native lambda with the following bytecode within it's {{doCall}} method:
> {code}
> INVOKESTATIC org/codehaus/groovy/runtime/dgmimpl/NumberNumberPlus.plus (Ljava/lang/Number;Ljava/lang/Number;)Ljava/lang/Number;
> {code}
> but moving the {{@compileStatic}} to the {{main}} method only, results in the following error:
> {code}
> java.lang.NoSuchMethodError: java.lang.Number.plus(Ljava/lang/Number;)Ljava/lang/Number;
> {code}
> and the following bytecode in the {{doCall}} method:
> {code}
> INVOKESTATIC java/lang/Number.plus (Ljava/lang/Number;)Ljava/lang/Number;
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)