[sealed] javac accepts sealed annotations

Tagir Valeev amaembo at gmail.com
Mon Aug 10 11:04:37 UTC 2020


My colleague discovered that latest javac (both 15-ea and 16-ea)
accepts sealed annotations. E.g.:

public sealed @interface MyAnno {
non-sealed interface Foo extends MyAnno {

The spec draft explicitly forbids this [1]:
> It is a compile-time error if an annotation type declaration has the modifier sealed (

With best regards,
Tagir Valeev.

[1] http://cr.openjdk.java.net/~gbierman/jep360/jep360-20200526/specs/sealed-classes-jls.html#jls-9.6

More information about the amber-dev mailing list