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

Update java.lang.invoke.VarHandle to use sealed classes

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 19
    • core-libs
    • None
    • minimal
    • VarHandle has no public constructor and cannot be subclassed by users.
    • Java API
    • SE

      Summary

      Update java.lang.invoke.VarHandle as a sealed class

      Problem

      As specified in the class specification, VarHandles cannot be subclassed by users. It does not have public constructor.

      Solution

      Make java.lang.invoke.VarHandle a sealed class.

      Specification

      -public abstract class VarHandle implements Constable {
      +public abstract sealed class VarHandle implements Constable

      All permitted classes are package-private and not listed in the above specification change. The javadoc of VarHandle shows that it's a public abstract sealed class without the permits clause.

            mchung Mandy Chung (Inactive)
            darcy Joe Darcy
            Joe Darcy, Paul Sandoz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: