[jdk16] RFR: 8258515: javac should issue an error if an annotation is nested in a local class or interface

Vicente Romero vromero at openjdk.java.net
Thu Dec 17 15:34:07 UTC 2020


Spec [1](http://cr.openjdk.java.net/~gbierman/8246771/8246771-20200928/specs/local-statics-jls.html), section 9.6 Annotation Interfaces states that:

"It is a compile-time error if an annotation declaration is nested within the body of a local class or interface declaration (14.3), or within the body of an anonymous class"

javac is not implementing this assertion. The proposed patch is fixing this issue,

TIA

-------------

Commit messages:
 - 8258515: No compilation error thrown when an annotation is declared within body of a local class

Changes: https://git.openjdk.java.net/jdk16/pull/43/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk16&pr=43&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8258515
  Stats: 129 lines in 10 files changed: 105 ins; 0 del; 24 mod
  Patch: https://git.openjdk.java.net/jdk16/pull/43.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk16 pull/43/head:pull/43

PR: https://git.openjdk.java.net/jdk16/pull/43


More information about the compiler-dev mailing list