Review Request: 8238358: Implementation of JEP 371: Hidden Classes

Mandy Chung mandy.chung at oracle.com
Sat Apr 4 16:45:20 UTC 2020



On 4/4/20 9:16 AM, Peter Levart wrote:
> Hi Mandy,
>
> Just another observation of the code in InnerClassLambdaMetafactory...
>
> For the useImplMethodHandle case you generate the protectedImplMethod 
> static field to hold the MH and a static setter method:
>
>             mv = cw.visitMethod(ACC_PRIVATE + ACC_STATIC,
>                                 "setImplMethod", DESCR_SET_IMPL_METHOD,
>                                 null, null);
>
> ...but then later after you define the class you inject the MH via a 
> "staticSetter" method handle:
>
>                 MethodHandle mh = 
> lookup.findStaticSetter(lookup.lookupClass(), NAME_FIELD_IMPL_METHOD, 
> MethodHandle.class);
>                 mh.invokeExact(implMethod);
>
> So you don't invoke the generated setter method but set the field via 
> special kind of method handle (equivalent to putstatic bytecode).
> You can remove the setImplMethod method generation code.
>

Good catch.   Removed the unused method.

Mandy

> Regards, Peter

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20200404/10831952/attachment.htm>


More information about the serviceability-dev mailing list