0

Suppose I have:

public class A<T, U> {}

public class B extends A<@C String, @C String> {}

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE_USE)
public @interface C {}

Jandex, via its TypeTarget interface, and its usage() method, can inform me that an AnnotationInstance targets some type usage in the extends clause. It can distinguish between a superclass (as we have here) and an interface implementation via the ClassExtendsTypeTarget#position() method (if it is 65535 (!) then it is a superclass, otherwise it is a zero-based index into the list of implemented interfaces).

But I cannot see an easy way (maybe any way?) to tell which of the two @C applications above might be represented by a given ClassExtendsTypeTarget occurrence. Am I missing something obvious?

Laird Nelson
  • 15,321
  • 19
  • 73
  • 127

0 Answers0