Error messages for local interfaces and enums when enable-preview is not specified

Tagir Valeev amaembo at gmail.com
Mon Jun 15 06:58:34 UTC 2020


Hello!

Checking with 15-ea+26-1287:

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. What do you think?

With best regards,
Tagir Valeev.


More information about the amber-dev mailing list