Duplicate :
|
|
Relates :
|
|
Relates :
|
A DESCRIPTION OF THE PROBLEM : Type annotations on type variable bounds are not detected if the bounds are themselves type variables. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Run the code example for a demonstration of the behavior. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - The type annotations of both type variable bounds are detected. ACTUAL - The type annotations of a type variable that is bound by another type variable is not detected. ---------- BEGIN SOURCE ---------- public class Foo { @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE_USE) @interface SampleTypeVariable { } <T, S extends @SampleTypeVariable T, U extends @SampleTypeVariable Object> void foo() { } public static void main(String[] args) throws Exception { Method foo = Foo.class.getDeclaredMethod("foo"); TypeVariable<Method>[] typeParameters = foo.getTypeParameters(); TypeVariable<?> s = typeParameters[1]; AnnotatedType[] annotatedBoundsOfS = s.getAnnotatedBounds(); System.out.println(annotatedBoundsOfS[0].getDeclaredAnnotations().length); TypeVariable<?> u = typeParameters[2]; AnnotatedType[] annotatedBoundsOfU = u.getAnnotatedBounds(); System.out.println(annotatedBoundsOfU[0].getDeclaredAnnotations().length); } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : None. FREQUENCY : always
|