< prev index next >

src/java.base/share/classes/java/time/chrono/JapaneseDate.java

Print this page
*** 110,22 ***
   * Calling {@code japaneseDate.get(YEAR)} will return 2012.<br>
   * Calling {@code japaneseDate.get(ERA)} will return 2, corresponding to
   * {@code JapaneseChronology.ERA_HEISEI}.<br>
   * <p>
   * This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
!  * class; programmers should treat instances that are
!  * {@linkplain #equals(Object) equal} as interchangeable and should not
!  * use instances for synchronization, or unpredictable behavior may
!  * occur. For example, in a future release, synchronization may fail.
!  * The {@code equals} method should be used for comparisons.
   *
   * @implSpec
   * This class is immutable and thread-safe.
   *
   * @since 1.8
   */
  @jdk.internal.ValueBased
  public final class JapaneseDate
          extends ChronoLocalDateImpl<JapaneseDate>
          implements ChronoLocalDate, Serializable {
  
      /**
--- 110,30 ---
   * Calling {@code japaneseDate.get(YEAR)} will return 2012.<br>
   * Calling {@code japaneseDate.get(ERA)} will return 2, corresponding to
   * {@code JapaneseChronology.ERA_HEISEI}.<br>
   * <p>
   * This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
!  * class; programmers should treat instances that are {@linkplain #equals(Object) equal}
!  * as interchangeable and should not use instances for synchronization, mutexes, or
!  * with {@linkplain java.lang.ref.Reference object references}.
!  *
!  * <div class="preview-block">
+  *      <div class="preview-comment">
+  *          When preview features are enabled, {@code JapaneseDate} is a {@linkplain Class#isValue value class}.
+  *          Use of value class instances for synchronization, mutexes, or with
+  *          {@linkplain java.lang.ref.Reference object references} result in
+  *          {@link IdentityException}.
+  *      </div>
+  * </div>
   *
   * @implSpec
   * This class is immutable and thread-safe.
   *
   * @since 1.8
   */
  @jdk.internal.ValueBased
+ @jdk.internal.MigratedValueClass
  public final class JapaneseDate
          extends ChronoLocalDateImpl<JapaneseDate>
          implements ChronoLocalDate, Serializable {
  
      /**
< prev index next >