RFR: 8174222: LambdaMetafactory: validate inputs and improve documentation [v2]

Dan Smith dlsmith at openjdk.java.net
Fri Jun 4 21:33:57 UTC 2021


On Fri, 4 Jun 2021 00:08:41 GMT, Mandy Chung <mchung at openjdk.org> wrote:

>> Dan Smith has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix accidentally commented-out parts of test
>
> src/java.base/share/classes/java/lang/invoke/LambdaMetafactory.java line 457:
> 
>> 455:      * @return a CallSite whose target can be used to perform capture, generating
>> 456:      *         instances of the interface named by {@code factoryType}
>> 457:      * @throws LambdaConversionException If {@code caller} does not have private
> 
> One additional comment:
> 
> The lookup access has been extended since 14 to include `MODULE` and `ORIGINAL` access.  
> `Lookup::hasFullPrivilegeAccess` returns true if the lookup has `PRIVATE` and `MODULE` which means that this lookup is not teleported from another module via `Lookup::in` and `MethodHandles::privateLookupIn`.
> 
> What privilege do you expect the `caller` lookup should have?  I believe full privilege access is the appropriate privilege.  The `ORIGINAL` access is stricter as the lookup must be created from the original lookup class.
> 
> [1] shows what access a `Lookup` has when being produced via different APIs.
> 
> [1] https://download.java.net/java/early_access/jdk17/docs/api/java.base/java/lang/invoke/MethodHandles.Lookup.html#access-modes

Thanks, yes I think `hasFullPrivilegeAccess` is what we want. I updated the javadoc, along with the actual check. Thanks for catching!

> test/jdk/java/lang/invoke/lambda/MetafactoryArgValidationTest.java line 2:
> 
>> 1: /*
>> 2:  * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
> 
> copyright year needs update.

Fixed. And I bumped it on the other files, too.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4346


More information about the core-libs-dev mailing list