RFR: 8338596: Clarify handling of restricted and caller-sensitive methods [v3]

Alan Bateman alanb at openjdk.org
Mon Sep 23 08:45:38 UTC 2024


On Thu, 19 Sep 2024 12:29:34 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> As I wrote in the CSR request for the JEP:
> 
> > I think each method that is restricted and/or caller-sensitive should specify what happens when called when there is no caller context. We should use `AccessibleObject::canAccess` as an exemplar here:
> > https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/reflect/AccessibleObject.html#canAccess(java.lang.Object)
> > I have no doubt other caller-sensitive methods have failed to do this to date, but that should be fixed.
> 
> This has to be mentioned in e.g. the javadoc for `System.loadLibrary`.

The changes in this PR means that the javadoc generated text "XXX is a restricted method of the Java platform" now links to the restricted method page. That page specifies that calling the method without a caller class will be treated as if called from code in an unnamed module.  Is your ask that the javadoc generated text inline this, or the equivalent by change the method description of each restricted method? I don't think this is critical for this this PR, and arguably a corner case to be upcalling from JNI attached threads.

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

PR Comment: https://git.openjdk.org/jdk/pull/21067#issuecomment-2367573567


More information about the core-libs-dev mailing list