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

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

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 16
    • Component/s: tools
    • Labels:

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated: