groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shil Sinha <shil.si...@gmail.com>
Subject Re: About the progress of supporting native lambda
Date Wed, 17 Jan 2018 08:16:29 GMT
>
> In addition, the following issue[4] should be fixed too. I think I have
> not found a correct way to use ClassNode instance, any help is appreciated!
> ```
> A transform used a generics containing ClassNode Test1 for the method
> public
> static int doCall(Test1 __this, java.lang.Integer e)  { ... } directly. You
> are not supposed to do this. Please create a new ClassNode referring to the
> old ClassNode and use the new ClassNode instead of the old one. Otherwise
> the compiler will create wrong descriptors and a potential
> NullPointerException in TypeResolver in the OpenJDK. If this is not your
> own
> doing, please report this bug to the writer of the transform.
> ```


You should use classNode.getPlainNodeReference() there.

On Wed, Jan 17, 2018 at 3:10 AM, Daniel Sun <realbluesun@hotmail.com> wrote:

> Hi all,
>
>      Currently Groovy 3 supports some common scenarios of native lambda[1]
> in the static compilation mode. Groovy's native lambda conforms to the
> semantic of Java's Lambda(e.g. `this` references the instance of the
> enclosing  class).
>
>      Since native lambda relies on static analysis, if static analysis
> fails[2][3], native lambda can not been compiled either. We should fix the
> issues(e.g.  GROOVY-8445 <https://issues.apache.org/
> jira/browse/GROOVY-8445>
> ).
>
>      In addition, the following issue[4] should be fixed too. I think I
> have
> not found a correct way to use ClassNode instance, any help is appreciated!
> ```
> A transform used a generics containing ClassNode Test1 for the method
> public
> static int doCall(Test1 __this, java.lang.Integer e)  { ... } directly. You
> are not supposed to do this. Please create a new ClassNode referring to the
> old ClassNode and use the new ClassNode instead of the old one. Otherwise
> the compiler will create wrong descriptors and a potential
> NullPointerException in TypeResolver in the OpenJDK. If this is not your
> own
> doing, please report this bug to the writer of the transform.
> ```
>
>      Next I plan to support callable native lambda(e.g. `(e -> { println e
> })('Hello, world!')`).
>
>      Here is the url of native-lambda branch of Groovy 3:
> https://github.com/apache/groovy/tree/native-lambda
>
> Cheers,
> Daniel.Sun
>
> [1]
> https://github.com/apache/groovy/blob/62c835b4e42071fb167934bb871763
> 89d4cd999f/src/test/groovy/transform/stc/LambdaTest.groovy
> [2]
> https://github.com/apache/groovy/blob/62c835b4e42071fb167934bb871763
> 89d4cd999f/src/test/groovy/transform/stc/LambdaTest.groovy#L58
> [3]
> https://github.com/apache/groovy/blob/62c835b4e42071fb167934bb871763
> 89d4cd999f/src/test/groovy/transform/stc/LambdaTest.groovy#L139
> [4]
> https://github.com/apache/groovy/blob/6bf63025ea0478f92ae7075990e90f
> 435cf656fc/src/main/java/org/codehaus/groovy/classgen/asm/
> sc/StaticTypesLambdaWriter.java#L267-L271
>
>
>
> --
> Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html
>

Mime
View raw message