Lambda and JSR 292 method handle

Rémi Forax forax at univ-mlv.fr
Fri Dec 18 06:48:28 PST 2009


Le 18/12/2009 15:41, Neal Gafter a écrit :
> On Fri, Dec 18, 2009 at 2:55 AM, Howard Lovatt<howard.lovatt at iee.org>wrote:
>
>    
>> I thought the idea from the JSR 292 group was to use JavaMethodHandle
>> [1] (which extends MethodHandle). The difference is that the
>> JavaMethodHandle retains the type information, needed by Java, and it
>> can implement interfaces so you can use a lambda with an existing
>> function.
>>      
>
> Do the types representing jsr292's JavaMethodHandle obey subtype
> relationships that make them covariant on return type and contravariant on
> argument types?

Yes, if they are invoked using invokeLambda() and no other invoke*.
For the record, even if this could changed, there are two other method 
invoke*,
invokeExact that requires the exaxct same signature and invokeGeneric 
that is able
to do conversion like boxing/unboxing etc.

> Or, at least, is it possible to use the consistently so
> they act that way?
>
> Cheers,
> Neal
>
>    

Cheers,
Rémi



More information about the lambda-dev mailing list