| Other |
|---|
| tbd_majorUnresolved |
|
Blocks :
|
|
|
Cloners :
|
|
|
Relates :
|
|
|
Relates :
|
Executable.getParameters()[0].getAnnotaetdType() has no type annotations for an annotated receiver.
Minimized repro:
----- 8< ------
import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.Arrays;
public class IsRecvAParam {
@Target(ElementType.TYPE_USE)
@Retention(RetentionPolicy.RUNTIME)
@interface A {
}
class Foo {
Foo(@A IsRecvAParam IsRecvAParam.this) {
}
}
public static void main(String args[]) {
Constructor<?> cons = IsRecvAParam.Foo.class.getDeclaredConstructors()[0];
System.out.println("TypeAnnotations on:");
System.out.println("getAnnotatedParameterTypes()[0]: " + Arrays.asList(cons.getAnnotatedParameterTypes()[0].getAnnotations()) +
" //correct no type annotation here");
System.out.println("getAnnotatedReciver(): " + Arrays.asList(cons.getAnnotatedReceiverType().getAnnotations()) + " //correct");
System.out.println("getParameters()[0].getAnnotatedType(): " + Arrays.asList(cons.getParameters()[0].getAnnotatedType().getAnnotations()) +
" //error");
}
}
----- 8< ------
|