Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5044125

javac allows cyclic annotation interfaces with arrays

XMLWordPrintable

    • b54
    • generic
    • solaris_8

      As you can see from the behavior of the following program, this should be prohibited.

      import java.lang.annotation.Retention;
      import static java.lang.annotation.RetentionPolicy.*;

      @Retention(RUNTIME)
      @interface A {
          A[] values() default { @A() };
      }

      @A()
      class Main {
          public static void main(String[] args) {
              A a = Main.class.getAnnotation(A.class);
              System.out.println(a);
          }
      }

            gafter Neal Gafter (Inactive)
            gafter Neal Gafter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: