Alternatives for Unsafe field access

Jochen Theodorou blackdrag at
Fri Dec 9 07:55:26 UTC 2016

On 08.12.2016 22:10, Uwe Schindler wrote:
> Hi,
> You can first do standard reflection, then use setAccessible

Maybe we have luck here and it does not apply, but if the field comes 
from a class of a module and is private, my current level knowledge of 
jigsaw says, that setAccessible will fail with an exception. It does not 
matter at all if the class with the field is exported or not. That is 
because just before the JavaOne #AwkwardStrongEncapsulation made it into 
jigsaw. Only way around this is to use the Lookup object that has the 
correct rights from the beginning. How to get it... well... there will 
be only solutions for certain types of classes.

bye Jochen

More information about the core-libs-dev mailing list