Community
Participate
Working Groups
I20050215-2300 The compiler must reject cyclic annotation element types. Javac spits out an error for nest(): "cyclic annotation element type". @Retention(RetentionPolicy.RUNTIME) @interface Nested { String name() default "Hans"; N2 nest(); } @interface N2 { Nested n2() default @Nested(name="Haus", nest= @N2); } Running the following class then gives a StackOverflowError (cyclic annotations seem to pass through the verifier without problems): @Nested(name="XY", nest= @N2) class Test { public static void main(String[] args) { Nested annotation= Test.class.getAnnotation(Nested.class); } }
*** Bug 81974 has been marked as a duplicate of this bug. ***
Added to AnnotationTest test003
Verified in I20050330-0500