Review Request JDK-8173975: Lookup::in should not allow target class be primitive or array class

Mandy Chung mandy.chung at oracle.com
Tue Oct 29 17:37:36 UTC 2019



On 10/15/19 2:26 AM, Alan Bateman wrote:
> On 14/10/2019 23:34, Mandy Chung wrote:
>> MethodHandles::lookup produces a Lookup object on the caller class. 
>> The original intention for a Lookup object whose lookup class is 
>> always a non-array and non-primitive class.
>>
>> MethodHandles::privateLookupIn and Lookup::in are the two other ways 
>> that can produce a new Lookup object and they should disallow the new 
>> lookup class be a primitive or array class.
>>
>> This patch proposes to make Lookup::in consistent with 
>> MethodHandles::privateLookupIn to throw IAE if the target class is an 
>> array type or primitive type.
>>
>>
>> CSR: https://bugs.openjdk.java.net/browse/JDK-8232227
>> webrev:
>> http://cr.openjdk.java.net/~mchung/jdk14/8173975/webrev.00/
> This change looks good and I've added myself as Reviewer to the CSR.

I updated the spec and CSR to explicitly call out void in @throw IAE 
behavior per Joe's suggestion (although Class::isPrimitive treats void 
as a primitive, that's not a natural categorization).

Revised webrev:
   http://cr.openjdk.java.net/~mchung/jdk14/8173975/webrev.01

Mandy


More information about the core-libs-dev mailing list