Compiler treats 'sealed' keyword as 'var' keyword

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 17
    • Affects Version/s: 16, 17
    • Component/s: tools
    • None
    • b08

      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`.

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

              Created:
              Updated:
              Resolved: