JEP 118 works with Lambda ?
alex.buckley at oracle.com
Wed Apr 16 18:59:06 UTC 2014
// Adding compiler-dev
Since lambda expressions are expressions, they cannot be reflected over
directly. However, if you know the method that a lambda expression is
compiled to, then you can obviously call getParameters() on the
That said, even if you compiled with -parameters, there are bugs in the
name generation for parameters of the method, so Parameter.getName()
doesn't work. This has been discussed on compiler-dev and is being fixed
for JDK 8u20.
On 4/16/2014 11:43 AM, Luan Cestari wrote:
> Hi, Good morning/afternoon/evening! =)
> I got this email from a reply of help at openjdk.java.net ( from
> https://bugs.openjdk.java.net/secure/Dashboard.jspa , where I was thinking
> to create an issue (maybe for enhance or bug, not really sure).
> I got a problem during a test using the getName from Parameter (from JEP
> 118, new in Java 8) with Lambda expression (also new in Java 8). I made a
> simple class to reproduce the issue which I posted here
> https://gist.github.com/luan-cestari/10902418 , where the getName works
> fine using other classes like in this other code I made
> https://gist.github.com/luan-cestari/10902332. I started to investigate
> that after I saw a gist ( https://gist.github.com/galdosd/10823529, which
> also created a discussion on
> saying that feature worked fine for him, so I talked with some guys in
> IRC ( OFTC#openjdk ), but we wasn't sure if it is a bug or not.
> I searched a bit and I found the following:
> - In http://openjdk.java.net/jeps/118 , it doesnt say about any
> exception around the Lambda functions
> - In Oracle documentation it mentions the JVM parameter that have to be
> used during the compilation to that work fine
> - In javadoc there is no more details about that (I think it could make
> more clear that there is a JVM parameter or maybe it is possible to have
> this kind of parameter. Also it could say about execptions such as Lambda
> - I also saw a mail list (
> where Remi and Brian exchanged some mails where he said it is had the
> 118 due there are people that want thing in a way and people who doesn't
> want some changes
> - In that mail, they cited this document
> http://cr.openjdk.java.net/~abuckley/8misc.pdf which I think that some
> parts of it are in JVM spec (
> - http://docs.oracle.com/javase/specs/ like
> http://docs.oracle.com/javase/specs/jvms/se8/jvms8.pdf and
> - ) but it just say the class structure in bytecode, nothing about
> Lambda and JEP 118
> As far as I know, Lambda will create some symbolic invocation using
> invokedynamic which is different than creating anonymous classes, so this
> might be the root cause of the issue. But maybe there is some difference in
> the native implementations (for example, in my case I'm using Fedora 20
> with OpenJDK Runtime Environment (build 1.8.0-b132) / OpenJDK 64-Bit Server
> VM (build 25.0-b70, mixed mode)). In the IRC, people said that maybe the
> IDE was generating the inner classes to make it work, but that would make a
> problem during the runtime if a different tool (like maven) compiles the
> In summary, is the right behavior for JEP 118 return argx due lambda
> expressions? Maybe we could enhance it to make some new features (for Java
> 9 ).
> Thank you in advance,
> Kindest regards,
> Luan Cestari
> "All the gold which is under or upon the earth is not enough to give in
> exchange for virtue."
> "At his best, man is the noblest of all animals; separated from law and
> justice he is the worst."
> "A true friend is one soul in two bodies."
> "The only limit to your impact is your imagination and commitment."
> Tony Robbins
More information about the compiler-dev