type annotation with TYPE_USE and FIELD attributed differently if repeated.

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 8
    • Affects Version/s: 8
    • Component/s: tools
    • b113
    • Verified

      A type annotation with ElementTypes TYPE_USE and FIELD placed on type argument is placed on the ctor if repeated and on the field if not repeated.

      Compile the below and run javap -v Test2.

      import java.lang.annotation.*;
      import static java.lang.annotation.RetentionPolicy.*;
      import static java.lang.annotation.ElementType.*;
      import java.util.List;

      class Test2<T> {
           String data = "test";
          Object mtest( Test2<T> t){ return null; }
          Object mmtest( Test2<T> t){ return null; }

          Test2< @A @A @C String> T2 = new Test2< String>();
      }

      @Retention(RUNTIME) @Target({TYPE_USE,FIELD}) @Repeatable( AC.class ) @interface A { }
      @Retention(RUNTIME) @Target({TYPE_USE,FIELD}) @interface AC { A[] value(); }

      @Retention(CLASS) @Target({TYPE_USE,FIELD}) @Repeatable( CC.class ) @interface C { }
      @Retention(CLASS) @Target({TYPE_USE,FIELD}) @interface CC { C[] value(); }

            Assignee:
            Eric Mccorkle
            Reporter:
            Steve Sides (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: