< prev index next >
src/java.base/share/classes/java/lang/reflect/AccessibleObject.java
Print this page
rev 58565 : 8238358: Implementation of JEP 371: Hidden Classes
Reviewed-by: duke
Contributed-by: mandy.chung@oracle.com, lois.foltan@oracle.com, david.holmes@oracle.com, harold.seigel@oracle.com, serguei.spitsyn@oracle.com, alex.buckley@oracle.com, jamsheed.c.m@oracle.com
@@ -174,10 +174,16 @@
* members with default (package) access, protected instance members, or
* protected constructors when the declaring class is in a different module
* to the caller and the package containing the declaring class is not open
* to the caller's module. </p>
*
+ * <p> This method cannot be used to enable {@linkplain Field#set <em>write</em>}
+ * access to a final field declared in a {@linkplain Class#isHiddenClass() hidden class},
+ * since such fields are not modifiable. The {@code accessible} flag when
+ * {@code true} suppresses Java language access control checks to only
+ * enable {@linkplain Field#get <em>read</em>} access to such fields.
+ *
* <p> If there is a security manager, its
* {@code checkPermission} method is first called with a
* {@code ReflectPermission("suppressAccessChecks")} permission.
*
* @param flag the new value for the {@code accessible} flag
< prev index next >