< prev index next >

src/java.base/share/classes/java/lang/Record.java

Print this page
@@ -65,10 +65,20 @@
   * <pre>
   *     R copy = new R(r.c1(), r.c2(), ..., r.cn());
   * </pre>
   * then it must be the case that {@code r.equals(copy)}.
   *
+  * <div class="preview-block">
+  *      <div class="preview-comment">
+  *          When preview features are enabled, {@code Record} is
+  *          an abstract {@linkplain Class#isValue value class}.
+  *          Subclasses of {@code Record} can be either an {@linkplain Class#isIdentity identity class}
+  *          or a {@linkplain Class#isValue value class}.
+  *          See {@jls The Java Language Specification 8.1.1.5 Value Classes}.
+  *      </div>
+  * </div>
+  *
   * @apiNote
   * A record class that {@code implements} {@link java.io.Serializable} is said
   * to be a <i>serializable record</i>. Serializable records are serialized and
   * deserialized differently than ordinary serializable objects. During
   * deserialization the record's canonical constructor is invoked to construct

@@ -85,10 +95,12 @@
   *
   * @spec serialization/index.html Java Object Serialization Specification
   * @jls 8.10 Record Classes
   * @since 16
   */
+ @jdk.internal.MigratedValueClass
+ @jdk.internal.ValueBased
  public abstract class Record {
      /**
       * Constructor for record classes to call.
       */
      protected Record() {}
< prev index next >