RFR: 8271820: Implementation of JEP 416: Reimplement Core Reflection with Method Handle [v16]

David Holmes david.holmes at oracle.com
Mon Nov 15 09:48:49 UTC 2021


Hi Alan,

On 15/11/2021 5:11 pm, Alan Bateman wrote:
> On 14/11/2021 22:56, Claes Redestad wrote:
>> :
>> Alan: changing `Field.modifiers` still works, but dropping the final 
>> modifier is not enough for this to work in the new impl. It won't be 
>> hard to adapt to the new world. Users who relies on this today could 
>> for example opt-out of the new MH-based impl using 
>> `-Djdk.reflect.useDirectMethodHandle=false` and get the old behavior. 
>> I've checked using a minimal reproducer I extracted from the Wicket 
>> sources that this works.
>>
> Sure, but I don't think that would be enough as Wicket would also need 
> to open java.lang and java.lang.reflect to allow it continue to access 
> private members of Class and Field. 

I think there may be a misunderstanding here, AFAICS they are using 
reflection to remove the final-ness of a field in their own classes, not 
modifying anything in Class or Field.

Cheers,
David
-----

> I assume the test started emitting 
> "Illegal reflective access ..." warnings in JDK 9 and it stopped working 
> in JDK 16, and somewhere along the line the maintainers must have added 
> --add-opens to get it to work. It's just not tenable, hopefully the 
> project will find a way to re-write that test.
> 
> -Alan


More information about the core-libs-dev mailing list