I'm using custom type use annotation. I can't read them from an object like any other regular annotation:
public class TestingAnnotations {
public static void main(final String[] args) {
final @CustomAnnotation TypeAnnotated b = new @CustomAnnotation TypeAnnotated();
System.out.println(b.getClass().getAnnotation(CustomAnnotation.class)); //<-- prints null :(
}
}
@Target({ElementType.TYPE_USE, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@interface CustomAnnotation {
}
class TypeAnnotated {
}
So, how can I check b instance is annotated?
Thanks