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

Repeated type-annotation on type parameter of local variable

    XMLWordPrintable

Details

    • b91
    • Verified

    Description

      Repeated type-annotations on type parameter of local variable are not written to classfile.

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

      class Test<T> {
          Test<@A @A @A String> t = new Test<>(); //ok

          public void test() {
              Test<@B String> t1 = new Test<>(); //ok
              Test<@A @A @A String> t2 = new Test<>(); //not ok
         }
      }

      @Target(TYPE_USE) @Repeatable( AC.class ) @interface A { }
      @Target(TYPE_USE) @interface AC { A[] value(); }
      @Target(TYPE_USE) @Repeatable( BC.class ) @interface B { }
      @Target(TYPE_USE) @interface BC { B[] value(); }

      Attachments

        Issue Links

          Activity

            People

              jfranck Joel Borggrén-Franck (Inactive)
              ssides Steve Sides
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: