JDK 8 - Lambda - Reflection issues

Remi Forax forax at univ-mlv.fr
Fri Mar 14 18:23:08 UTC 2014


On 03/13/2014 11:09 AM, Paul Sandoz wrote:
> On Mar 12, 2014, at 7:42 PM, Remi Forax <forax at univ-mlv.fr> wrote:
>> As you have seen a lambda is not an anonymous class :)
>>
>> A non-serializable lambda is more lightweight than an anonymous class so the generic information that are transmitted from the bytecode to the runtime (the lambda metafactory) are not kept inside the lambda class (a lambda class may be shared by several different lambdas).
>>
> Seems like the reflection API is at the wrong level and a Java model/mirror API might be able to handle this correctly?

yes, it's a hack,
using a declared type (type are artifact of the compiler) at runtime (in 
the VM realm) to convert a message is not very natural.

yes, it's possible to use an annotation processor for that, it's a far 
better that trying to emulate the compiler job at runtime.
Now, requiring an annotation processor make the API heavier to use.

>
> Paul.
>

cheers,
Rémi



More information about the jdk8-dev mailing list