Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8298628

8.1.4. Superclasses and Subclasses omits explicit mention of records

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • 21
    • 19
    • specification
    • None

      JLS 8.1.4 (https://docs.oracle.com/javase/specs/jls/se19/html/jls-8.html#jls-8.1.4) states:

      The direct superclass type of a class whose declaration lacks an extends clause is as follows:
          * The class Object has no direct superclass type.
          * For a class other than Object with a normal class declaration, the direct superclass type is Object.
          * For an enum class E, the direct superclass type is Enum<E>.
          * For an anonymous class, the direct superclass type is defined in §15.9.5.

      Record classes, like enum classes, lack an extends clause; however, the record cases is not included in this class. JLS 8.10. Record Classes does explicitly state:

      The direct superclass type of a record class is Record (§8.1.4).

            gbierman Gavin Bierman
            darcy Joe Darcy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: