Hi,
there are 2 parts to your question.
1. Jandex is a [relatively] faithful representation of JVM class files. If it's not in the bytecode, you're not getting it from Jandex. Your index is created by `Index.of(MyClass.class)` and hence only contains information from the class file of `MyClass`. That is, you can get the information that the class is annotated by `@Direct`, but you cannot obtain the declaration of `Direct`. As a perhaps better example, consider a somewhat different declaration of the `Direct` annotation type. Say it contains a member with a default value, like
public @interface Direct {
String value() default "foobar";
}
Further, assume that the occurrence of `@Direct` in `MyClass` doesn't specify the value of `value()`, just like in your example. Jandex would be able to tell you that `MyClass` is annotated `@Direct`, but wouldn't be able to give you the value of `value()`. Why? Because the class file doesn't contain that information. Jandex's `AnnotationInstance` provides a set of methods to read a value of given annotation member which don't consider the default value (you will just get `null`), and a second set of methods that do consider the default value. The second set of methods accept an `IndexView` as a parameter, and that `IndexView` must contain the declaration of the annotation type. That's where the default value is read from.
It is generally good to create as much complete indexes as possible. It is practically never possible to create a fully complete index, because such index would typically have to contain [a subset of] the JDK standard library, which is not practical. As a good compromise, it is common to create indexes on a JAR granularity. JARs may carry their own indexes, typically in `META-INF/jandex.idx`.
2. As mentioned above, a Jandex `ClassInfo` contains information just from a single class file. Indirect annotations ("stereotypes") are not present in the class file, so they are not present in the `ClassInfo`. You have to find annotations on the class, lookup their declarations, find annotations on them, etc. It is common to do that recursively, but I found that the worklist algorithm is typically a lot better, often combined with a set of class names that were already processed (and those can be skipped quickly when they appear in the worklist multiple times).
Hope that helps,
LT