Details
-
Bug
-
Resolution: Fixed
-
P3
-
8
-
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(); }
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
- relates to
-
JDK-8008746 add tests for type-annotation in anonymous classes
- Resolved