< prev index next >

src/java.base/share/classes/java/lang/invoke/Stable.java

Print this page
rev 12617 : [mq]: 8134356-gt-lt-in-code


  34  * If the field is typed as an array, then all the non-null components
  35  * of the array, of depth up to the rank of the field's array type,
  36  * also count as component values.
  37  * By extension, any variable (either array or field) which has annotated
  38  * as stable is called a stable variable, and its non-null or non-zero
  39  * value is called a stable value.
  40  * <p>
  41  * Since all fields begin with a default value of null for references
  42  * (resp., zero for primitives), it follows that this annotation indicates
  43  * that the first non-null (resp., non-zero) value stored in the field
  44  * will never be changed.
  45  * <p>
  46  * If the field is not of an array type, there are no array elements,
  47  * then the value indicated as stable is simply the value of the field.
  48  * If the dynamic type of the field value is an array but the static type
  49  * is not, the components of the array are <em>not</em> regarded as stable.
  50  * <p>
  51  * If the field is an array type, then both the field value and
  52  * all the components of the field value (if the field value is non-null)
  53  * are indicated to be stable.
  54  * If the field type is an array type with rank {@code N &gt; 1},
  55  * then each component of the field value (if the field value is non-null),
  56  * is regarded as a stable array of rank {@code N-1}.
  57  * <p>
  58  * Fields which are declared {@code final} may also be annotated as stable.
  59  * Since final fields already behave as stable values, such an annotation
  60  * indicates no additional information, unless the type of the field is
  61  * an array type.
  62  * <p>
  63  * It is (currently) undefined what happens if a field annotated as stable
  64  * is given a third value.  In practice, if the JVM relies on this annotation
  65  * to promote a field reference to a constant, it may be that the Java memory
  66  * model would appear to be broken, if such a constant (the second value of the field)
  67  * is used as the value of the field even after the field value has changed.
  68  */
  69 /* package-private */
  70 @Target(ElementType.FIELD)
  71 @Retention(RetentionPolicy.RUNTIME)
  72 @interface Stable {
  73 }


  34  * If the field is typed as an array, then all the non-null components
  35  * of the array, of depth up to the rank of the field's array type,
  36  * also count as component values.
  37  * By extension, any variable (either array or field) which has annotated
  38  * as stable is called a stable variable, and its non-null or non-zero
  39  * value is called a stable value.
  40  * <p>
  41  * Since all fields begin with a default value of null for references
  42  * (resp., zero for primitives), it follows that this annotation indicates
  43  * that the first non-null (resp., non-zero) value stored in the field
  44  * will never be changed.
  45  * <p>
  46  * If the field is not of an array type, there are no array elements,
  47  * then the value indicated as stable is simply the value of the field.
  48  * If the dynamic type of the field value is an array but the static type
  49  * is not, the components of the array are <em>not</em> regarded as stable.
  50  * <p>
  51  * If the field is an array type, then both the field value and
  52  * all the components of the field value (if the field value is non-null)
  53  * are indicated to be stable.
  54  * If the field type is an array type with rank {@code N > 1},
  55  * then each component of the field value (if the field value is non-null),
  56  * is regarded as a stable array of rank {@code N-1}.
  57  * <p>
  58  * Fields which are declared {@code final} may also be annotated as stable.
  59  * Since final fields already behave as stable values, such an annotation
  60  * indicates no additional information, unless the type of the field is
  61  * an array type.
  62  * <p>
  63  * It is (currently) undefined what happens if a field annotated as stable
  64  * is given a third value.  In practice, if the JVM relies on this annotation
  65  * to promote a field reference to a constant, it may be that the Java memory
  66  * model would appear to be broken, if such a constant (the second value of the field)
  67  * is used as the value of the field even after the field value has changed.
  68  */
  69 /* package-private */
  70 @Target(ElementType.FIELD)
  71 @Retention(RetentionPolicy.RUNTIME)
  72 @interface Stable {
  73 }
< prev index next >