RFR: JDK-8221642: AccessibleObject::setAccessible throws NPE when invoked by JNI code with no java frame on stack

Mandy Chung mchung at openjdk.java.net
Fri Jan 28 17:57:36 UTC 2022


`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.

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

Commit messages:
 - Fix typo
 - 8221642: AccessibleObject::setAccessible throws NPE when invoked by JNI code with no java frame on stack

Changes: https://git.openjdk.java.net/jdk/pull/7271/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7271&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8221642
  Stats: 193 lines in 3 files changed: 166 ins; 19 del; 8 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7271.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7271/head:pull/7271

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


More information about the core-libs-dev mailing list