-
Bug
-
Resolution: Fixed
-
P2
-
16
-
b30
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8258641 | 17 | Vicente Arturo Romero Zaldivar | P2 | Resolved | Fixed | b03 |
JDK-8260171 | 16.0.1 | Vicente Arturo Romero Zaldivar | P2 | Resolved | Fixed | b03 |
Please refer to below code:
public class Test {
public static void main(String[] args) {
class LocalCls {
@interface TestAnnot {}
}
}
}
As per assertion "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 (15.9.5).", the above code should result in error. However, no compilation error is thrown.
[1] http://cr.openjdk.java.net/~gbierman/8246771/8246771-20200928/specs/local-statics-jls.html , see section: "9.6 Annotation Interfaces"
public class Test {
public static void main(String[] args) {
class LocalCls {
@interface TestAnnot {}
}
}
}
As per assertion "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 (15.9.5).", the above code should result in error. However, no compilation error is thrown.
[1] http://cr.openjdk.java.net/~gbierman/8246771/8246771-20200928/specs/local-statics-jls.html , see section: "9.6 Annotation Interfaces"
- backported by
-
JDK-8258641 javac should issue an error if an annotation is nested in a local class or interface
- Resolved
-
JDK-8260171 javac should issue an error if an annotation is nested in a local class or interface
- Resolved