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

Compiler treats 'sealed' keyword as 'var' keyword

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 17
    • 16, 17
    • tools
    • None
    • b08

    Description

      Code sample:

      public class Main {
        public static void main(String[] args) {
          sealed s = "s";
          System.out.println(s);
        }
      }

      Compile with --enable-preview, or just run `java` on this file. E.g:
      "C:\Program Files\Java\jdk-16\bin\java.exe" --enable-preview --source=16 Main.java

      Expected:
      Compilation error at line #3

      Actual:
      Successfully compiled and launched, as if `sealed` were `var`.

      Attachments

        Issue Links

          Activity

            People

              vromero Vicente Arturo Romero Zaldivar
              tvaleev Tagir Valeev
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: