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

Make ConstantDesc class hierarchy sealed

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 17
    • Fix Version/s: 17
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b25

      Description

      The class hierarchy rooted at `ConstantDesc` in package `java.language.constant` is used to denote a nominal descriptor for a loadable constant value, as defined in JVMS 4.4.

      The javadoc for these classes mentions that this hierarchy may become sealed if supported by the Java language, for example:

      * @apiNote In the future, if the Java language permits, {@linkplain ConstantDesc}
       * may become a {@code sealed} interface, which would prohibit subclassing except by
       * explicitly permitted types. Clients can assume that the following
       * set of subtypes is exhaustive: {@link String}, {@link Integer},
       * {@link Long}, {@link Float}, {@link Double}, {@link ClassDesc},
       * {@link MethodTypeDesc}, {@link MethodHandleDesc}, and
       * {@link DynamicConstantDesc}; this list may be extended to reflect future
       * changes to the constant pool format as defined in JVMS 4.4.
       

      Now JEP 409 proposes that sealed classes become a final feature, we can amend the class hierarchy to be sealed.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              gbierman Gavin Bierman
              Reporter:
              gbierman Gavin Bierman
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: