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

Vicente Romero vicente.romero at oracle.com
Thu Jun 18 23:10:51 UTC 2020


Hi,

Yes I guess that it make sense to add a more explanatory error message 
in this case. I have created [1] to track it.

Vicente

[1] https://bugs.openjdk.java.net/browse/JDK-8247897

On 6/15/20 2:58 AM, Tagir Valeev wrote:
> 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