XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: New
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      According to JLS 8.10 Record Declarations. The direct superclass type of a record class is java.lang.Record.

      However, for primitive classes the value class inherits from the reference class, not java.lang.Record.

      Example;


      public class RecordTest {
          inline static record R(int x) {}

          public static void main(String... args) {
              R r = new R(10);
              System.out.println(r.x);
          }
      }

      >> javap 'RecordTest$R'
      Compiled from "RecordTest.java"
      final value class RecordTest$R extends RecordTest$R$ref {
        public final java.lang.String toString();
        public final int hashCode();
        public final boolean equals(java.lang.Object);
        public int x();
        static RecordTest$R RecordTest$R(int);
      }

      >> javap 'RecordTest$R.ref'
      Compiled from "RecordTest.java"
      abstract class RecordTest$R$ref extends java.lang.Record {
      }

        Attachments

          Activity

            People

            Assignee:
            jlaskey Jim Laskey
            Reporter:
            jlaskey Jim Laskey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: