improve error message for local interfaces and enums when enable-preview is not specified

XMLWordPrintable

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: P4
    • 16
    • Affects Version/s: None
    • Component/s: tools

      Code:
      public class Test {
        public static void main(String[] args) {
          interface Foo {}
        }
      }

      An error message says:

      "C:\Program Files\Java\jdk-15\bin\java.exe" Test.java
      Test.java:3: error: interface not allowed here
          interface Foo {}
          ^
      1 error
      error: compilation failed

      I would expect it to be like 'local interfaces are a preview feature
      and are disabled by default'.

      The same for local enums.

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

              Created:
              Updated:
              Resolved: