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

type annotation with TYPE_USE and FIELD attributed differently if repeated.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 8
    • 8
    • tools
    • b113
    • Verified

    Description

      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(); }

      Attachments

        Issue Links

          Activity

            People

              emc Eric Mccorkle
              ssides Steve Sides
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: