test/tools/javac/annotations/repeatingAnnotations/CyclicAnnotation.java

changeset 1386
bf76f4190ef8
child 1492
df694c775e8a
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/annotations/repeatingAnnotations/CyclicAnnotation.java	Fri Nov 02 14:35:57 2012 -0700
     1.3 @@ -0,0 +1,26 @@
     1.4 +/**
     1.5 + * @test    /nodynamiccopyright/
     1.6 + * @bug     7169362
     1.7 + * @author  sogoel
     1.8 + * @summary Cyclic annotation not allowed
     1.9 + * @compile/fail/ref=CyclicAnnotation.out -XDrawDiagnostics CyclicAnnotation.java
    1.10 + */
    1.11 +
    1.12 +import java.lang.annotation.ContainedBy;
    1.13 +import java.lang.annotation.ContainerFor;
    1.14 +
    1.15 +@ContainedBy(Foo.class)
    1.16 +@ContainerFor(Baz.class)
    1.17 +@interface Baz {
    1.18 +    Foo[] value() default {};
    1.19 +}
    1.20 +
    1.21 +@ContainedBy(Baz.class)
    1.22 +@ContainerFor(Foo.class)
    1.23 +@interface Foo{
    1.24 +    Baz[] value() default {};
    1.25 +}
    1.26 +
    1.27 +@Foo(value = {@Baz,@Baz})
    1.28 +@Baz(value = {@Foo,@Foo})
    1.29 +public class CyclicAnnotation {}

mercurial