lambda and MethodHandles in current prototype
Peter Levart
peter.levart at gmail.com
Sun Nov 27 03:14:08 PST 2011
On Sunday, November 27, 2011 11:31:27 AM Rémi Forax wrote:
> >> *) optionally (if you use the -XDlambdaToMethod flag), the compiler will
> >> use 292, by passing method handles on to a fake BSM lambda metafactory
> >> that will spin the bytecode on the fly.
> > I see.
> >
> > I experimented with modified implementation of ProxyHelper.metaFactory and observed that the 2nd argument to
> >
> > metaFactory(
> > MethodHandles.Lookup caller,
> > String invokedName,
> > MethodType invokedType,
> > Class<?> samClass,
> > MethodHandle handle
> > )
> >
> > is currently allways invoked with a constant String "lambda". Is this meant to be specified as the target method name or something similar that will facilitate serializability of SAM instances?
>
> Hi Peter,
> good question !
>
> The name of the handle (which is opaque for you but not for the VM)
> is enough to make the lambda serializable.
MethodHandleNatives provides such access, right?
>
> The calling name has to be provided to be compliant with JSR 292,
> but is not used at all currently.
Ah, I see. This is the "method name" used in invokedynamic.
>
> >
> > Regards, Peter
>
> Rémi
>
More information about the lambda-dev
mailing list