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

[lworld] Compiler erroneously rejects abstract non-sealed value classes

XMLWordPrintable

      According to JEP 401 spec,
      a value class can be abstract and non-sealed

      8.1.1 Class Modifiers
      A class declaration may include class modifiers.
      ClassModifier:
      (one of)
      Annotation public protected private
      abstract static final sealed non-sealed strictfp
      value

      However, the compiler rejects the following code:

      abstract sealed value class Q permits A{}

      abstract non-sealed value class A extends Q {}

      value class B extends A {}

      public void main() {
          new B();
      }

      java: illegal combination of modifiers: value and non-sealed


            vromero Vicente Arturo Romero Zaldivar
            eananeva Ella Ananeva
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: