Lambda and JSR 292 method handle
Howard Lovatt
howard.lovatt at iee.org
Fri Dec 18 06:57:46 PST 2009
Oops - just reread what you said - the answer is it depends on the
interface you implement. JavaMethodHandle is intended to look just
like a normal Java method. Therefore the arguments you give to the
JavaMethodHandle must be assignment compatible with the actual
lambda's arguments (but will auto box/unbox) and the return type will
be as specified for the actual lambda (again with box/unbox).
2009/12/18 Neal Gafter <neal at gafter.com>:
> 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? Or, at least, is it possible to use the consistently so
> they act that way?
>
> Cheers,
> Neal
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
--
-- Howard.
More information about the lambda-dev
mailing list