On Fri, 28 Jan 2022 17:50:19 GMT, Mandy Chung <mch...@openjdk.org> wrote:

> `AccessibleObject::setAccessible` and `trySetAccessible` methods should only 
> allow access to public member of a public type that is unconditionally 
> exported consistent with the access check as described in the class 
> specification, when invoked by JNI code with no Java class on the stack.   
> The current implementation throws NPE when finding the module of the caller 
> class as the caller class is null.
> 
> The specification of `canAccess`, `setAccessible` and `trySetAccessible` are 
> updated to specify the behavior when the caller class is null.   I consider 
> this spec update as a clarification as the class specification covers this 
> case.

src/java.base/share/classes/java/lang/reflect/AccessibleObject.java line 260:

> 258:      * <p> If this method is invoked by <a 
> href="{@docRoot}/../specs/jni/index.html">JNI code</a>
> 259:      * with no caller class on the stack, the {@code accessible} flag can
> 260:      * only set if the member and the declaring class are public, and

s/only set/only be set/

-------------

PR: https://git.openjdk.java.net/jdk/pull/7271

Reply via email to