RFR [9]: 8177036: Class.checkMemberAccess throws NPE when calling Class methods via JNI

Peter Levart peter.levart at gmail.com
Mon Mar 20 11:54:08 UTC 2017

On 03/20/2017 12:42 PM, Peter Levart wrote:
> Currently core reflection throws InternalError (because of the check 
> in Reflection::ensureMemberAccess). But jake repo already contains 
> changes that remove this check and NPE is thrown later on in 
> verifyModuleAccess...
> Regards, Peter 

...it is actually even more erratic. If the invocation of core 
reflection is performed from JNI with no caller on a freshly constructed 
Member object, then the call often always succeeds (unless the member is 
protected instance member accessed from subclass), because 
AccessibleObject cache with no cached entry is mistakenly treated as 
'null' caller.  If the Member object is 1st used from a non-null caller, 
only then InternalError is thrown when such Member is later invoked from 
JNI with no caller.

Regards, Peter

More information about the core-libs-dev mailing list