Alternatives for Unsafe field access
Jochen Theodorou
blackdrag at gmx.org
Fri Dec 9 07:57:19 UTC 2016
On 09.12.2016 08:55, Jochen Theodorou wrote:
> 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.
oh, forgot... it works if the module is made open from the command line
or declared as such as a work around
bye Jcohen
More information about the core-libs-dev
mailing list