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

Peter Levart peter.levart at gmail.com
Mon Mar 20 11:42:15 UTC 2017



On 03/20/2017 11:41 AM, Alan Bateman wrote:
> On 20/03/2017 09:19, Claes Redestad wrote:
>
>> Hi,
>>
>> please review this fix to avoid NPEs when calling certain Class 
>> methods via JNI:
>>
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8177036
>> Webrev: http://cr.openjdk.java.net/~redestad/8177036/jdk.01/
> This looks okay. At some point then we need to see how we can test 
> these methods called from attached thread (with no caller).
>
> -Alan

I guess that when only the ClassLoader of the caller is checked in logic 
of @CS method, such calls should behave as though the caller was some 
class loaded by bootstrap ClassLoader. But what about @CS methods that 
inspect the caller class more deeply (such as reflection API) where the 
identity of the caller, its package and module play role in decisions? 
What behavior is expected in such cases? Should core reflection always 
allow access when invoked from "null" caller?

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



More information about the core-libs-dev mailing list