< prev index next >
src/java.base/share/classes/java/lang/reflect/Field.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
*** 719,732 ****
*
* <p>If this {@code Field} object is enforcing Java language access control, and
* the underlying field is inaccessible, the method throws an
* {@code IllegalAccessException}.
*
! * <p>If the underlying field is final, the method throws an
! * {@code IllegalAccessException} unless {@code setAccessible(true)}
! * has succeeded for this {@code Field} object
! * and the field is non-static. Setting a final field in this way
* is meaningful only during deserialization or reconstruction of
* instances of classes with blank final fields, before they are
* made available for access by other parts of a program. Use in
* any other context may have unpredictable effects, including cases
* in which other parts of a program continue to use the original
--- 719,741 ----
*
* <p>If this {@code Field} object is enforcing Java language access control, and
* the underlying field is inaccessible, the method throws an
* {@code IllegalAccessException}.
*
! * <p>If the underlying field is final, this {@code Field} object has
! * <em>write</em> access if and only if the following conditions are met:
! * <ul>
! * <li>{@link #setAccessible(boolean) setAccessible(true)} has succeeded for
! * this {@code Field} object;</li>
! * <li>the field is non-static; and</li>
! * <li>the field's declaring class is not a {@linkplain Class#isHiddenClass()
! * hidden class}.</li>
! * </ul>
! * If any of the above checks is not met, this method throws an
! * {@code IllegalAccessException}.
! *
! * <p> Setting a final field in this way
* is meaningful only during deserialization or reconstruction of
* instances of classes with blank final fields, before they are
* made available for access by other parts of a program. Use in
* any other context may have unpredictable effects, including cases
* in which other parts of a program continue to use the original
*** 754,764 ****
* @param value the new value for the field of {@code obj}
* being modified
*
* @throws IllegalAccessException if this {@code Field} object
* is enforcing Java language access control and the underlying
! * field is either inaccessible or final.
* @throws IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
* or if an unwrapping conversion fails.
* @throws NullPointerException if the specified object is null
--- 763,774 ----
* @param value the new value for the field of {@code obj}
* being modified
*
* @throws IllegalAccessException if this {@code Field} object
* is enforcing Java language access control and the underlying
! * field is inaccessible or final;
! * or if this {@code Field} object has no write access.
* @throws IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
* or if an unwrapping conversion fails.
* @throws NullPointerException if the specified object is null
*** 789,799 ****
* @param z the new value for the field of {@code obj}
* being modified
*
* @throws IllegalAccessException if this {@code Field} object
* is enforcing Java language access control and the underlying
! * field is either inaccessible or final.
* @throws IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
* or if an unwrapping conversion fails.
* @throws NullPointerException if the specified object is null
--- 799,810 ----
* @param z the new value for the field of {@code obj}
* being modified
*
* @throws IllegalAccessException if this {@code Field} object
* is enforcing Java language access control and the underlying
! * field is either inaccessible or final;
! * or if this {@code Field} object has no write access.
* @throws IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
* or if an unwrapping conversion fails.
* @throws NullPointerException if the specified object is null
*** 825,835 ****
* @param b the new value for the field of {@code obj}
* being modified
*
* @throws IllegalAccessException if this {@code Field} object
* is enforcing Java language access control and the underlying
! * field is either inaccessible or final.
* @throws IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
* or if an unwrapping conversion fails.
* @throws NullPointerException if the specified object is null
--- 836,847 ----
* @param b the new value for the field of {@code obj}
* being modified
*
* @throws IllegalAccessException if this {@code Field} object
* is enforcing Java language access control and the underlying
! * field is either inaccessible or final;
! * or if this {@code Field} object has no write access.
* @throws IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
* or if an unwrapping conversion fails.
* @throws NullPointerException if the specified object is null
*** 861,871 ****
* @param c the new value for the field of {@code obj}
* being modified
*
* @throws IllegalAccessException if this {@code Field} object
* is enforcing Java language access control and the underlying
! * field is either inaccessible or final.
* @throws IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
* or if an unwrapping conversion fails.
* @throws NullPointerException if the specified object is null
--- 873,884 ----
* @param c the new value for the field of {@code obj}
* being modified
*
* @throws IllegalAccessException if this {@code Field} object
* is enforcing Java language access control and the underlying
! * field is either inaccessible or final;
! * or if this {@code Field} object has no write access.
* @throws IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
* or if an unwrapping conversion fails.
* @throws NullPointerException if the specified object is null
*** 897,907 ****
* @param s the new value for the field of {@code obj}
* being modified
*
* @throws IllegalAccessException if this {@code Field} object
* is enforcing Java language access control and the underlying
! * field is either inaccessible or final.
* @throws IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
* or if an unwrapping conversion fails.
* @throws NullPointerException if the specified object is null
--- 910,921 ----
* @param s the new value for the field of {@code obj}
* being modified
*
* @throws IllegalAccessException if this {@code Field} object
* is enforcing Java language access control and the underlying
! * field is either inaccessible or final;
! * or if this {@code Field} object has no write access.
* @throws IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
* or if an unwrapping conversion fails.
* @throws NullPointerException if the specified object is null
*** 933,943 ****
* @param i the new value for the field of {@code obj}
* being modified
*
* @throws IllegalAccessException if this {@code Field} object
* is enforcing Java language access control and the underlying
! * field is either inaccessible or final.
* @throws IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
* or if an unwrapping conversion fails.
* @throws NullPointerException if the specified object is null
--- 947,958 ----
* @param i the new value for the field of {@code obj}
* being modified
*
* @throws IllegalAccessException if this {@code Field} object
* is enforcing Java language access control and the underlying
! * field is either inaccessible or final;
! * or if this {@code Field} object has no write access.
* @throws IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
* or if an unwrapping conversion fails.
* @throws NullPointerException if the specified object is null
*** 969,979 ****
* @param l the new value for the field of {@code obj}
* being modified
*
* @throws IllegalAccessException if this {@code Field} object
* is enforcing Java language access control and the underlying
! * field is either inaccessible or final.
* @throws IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
* or if an unwrapping conversion fails.
* @throws NullPointerException if the specified object is null
--- 984,995 ----
* @param l the new value for the field of {@code obj}
* being modified
*
* @throws IllegalAccessException if this {@code Field} object
* is enforcing Java language access control and the underlying
! * field is either inaccessible or final;
! * or if this {@code Field} object has no write access.
* @throws IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
* or if an unwrapping conversion fails.
* @throws NullPointerException if the specified object is null
*** 1005,1015 ****
* @param f the new value for the field of {@code obj}
* being modified
*
* @throws IllegalAccessException if this {@code Field} object
* is enforcing Java language access control and the underlying
! * field is either inaccessible or final.
* @throws IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
* or if an unwrapping conversion fails.
* @throws NullPointerException if the specified object is null
--- 1021,1032 ----
* @param f the new value for the field of {@code obj}
* being modified
*
* @throws IllegalAccessException if this {@code Field} object
* is enforcing Java language access control and the underlying
! * field is either inaccessible or final;
! * or if this {@code Field} object has no write access.
* @throws IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
* or if an unwrapping conversion fails.
* @throws NullPointerException if the specified object is null
*** 1041,1051 ****
* @param d the new value for the field of {@code obj}
* being modified
*
* @throws IllegalAccessException if this {@code Field} object
* is enforcing Java language access control and the underlying
! * field is either inaccessible or final.
* @throws IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
* or if an unwrapping conversion fails.
* @throws NullPointerException if the specified object is null
--- 1058,1069 ----
* @param d the new value for the field of {@code obj}
* being modified
*
* @throws IllegalAccessException if this {@code Field} object
* is enforcing Java language access control and the underlying
! * field is either inaccessible or final;
! * or if this {@code Field} object has no write access.
* @throws IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
* or if an unwrapping conversion fails.
* @throws NullPointerException if the specified object is null
< prev index next >