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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • 16
    • None
    • 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.

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

              Created:
              Updated:
              Resolved: