mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8247444: Trust final fields in records
Co-authored-by: Christoph Dreis <christoph.dreis@freenet.de> Reviewed-by: jrose, dholmes, forax, coleenp, vlivanov
This commit is contained in:
parent
983e012c9f
commit
f2b191a6e9
26 changed files with 227 additions and 49 deletions
|
@ -177,10 +177,16 @@ public class AccessibleObject implements AnnotatedElement {
|
|||
* 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#isHidden() 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.
|
||||
* access to a <em>non-modifiable</em> final field. The following fields
|
||||
* are non-modifiable:
|
||||
* <ul>
|
||||
* <li>static final fields declared in any class or interface</li>
|
||||
* <li>final fields declared in a {@linkplain Class#isHidden() hidden class}</li>
|
||||
* <li>final fields declared in a {@linkplain Class#isRecord() record}</li>
|
||||
* </ul>
|
||||
* <p> The {@code accessible} flag when {@code true} suppresses Java language access
|
||||
* control checks to only enable {@linkplain Field#get <em>read</em>} access to
|
||||
* these non-modifiable final fields.
|
||||
*
|
||||
* <p> If there is a security manager, its
|
||||
* {@code checkPermission} method is first called with a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue