> On Jul 8, 2020, at 12:08 PM, Mandy Chung <mandy.ch...@oracle.com> wrote:
>
>
>
> 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`.
Ok.
>
> 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.
I was going to remove the null check but was concerned that there might be
other cases where the argument
might be null.
Should I add an assert or just let the NPE happen?
Bob.
>
> Mandy