RFR: 8249080 - Reduce MemberName class dependency on MethodHandles

Mandy Chung mandy.chung at oracle.com
Wed Jul 8 16:08:59 UTC 2020


On 7/8/20 8:19 AM, Bob Vandette wrote:
> Please review this RFE for JDK 16 that reduces a class dependency in the MethodHandles.Lookup class.
>
> The ensureInitialized method from MethodHandles.Lookup creates a transient MemberName object only
> to be used to throw an exception. This exception can be created in a more efficient manner without
> using this class reducing the number of classes required. This reduction in dependencies is beneficial
> to the GraalVM native-image tool and will be useful for future Leyden native image implementations.

I agree that Lookup::ensureInitialized should not depend MemberName.  
This refactoring seems a reasonable approach.

> RFE:
>
> https://bugs.openjdk.java.net/browse/JDK-8249080
>
> WEBREV:
>
> http://cr.openjdk.java.net/~bobv/8249080/webrev.01/
>
3537         /**
3538          * Perform necessary <a 
href="MethodHandles.Lookup.html#secmgr">access checks</a>
3539          * for findClass or accessClass.
3540          */

This should also mention `ensureInitialized`.

3578             if (m == null) {
3579             // Step 2b:
3580                 if (!fullPowerLookup) {
3581 smgr.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
3582                 }
3583                 return;
3584             }

This is no longer needed.  Instead, this method should require a 
non-null MemberName argument.

Mandy


More information about the core-libs-dev mailing list