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