Is the defining classloader of a class level annotation always a parent of the initiating classloader of that class?
Suppose the following: @SomeAnnotation public interface Foo { } I would like to know if it is always the case that either the defining classloader of SomeAnnotation is equal to or a parent of the initiating classloader of Foo . I have read JVMS v8 section 5.3 . but I'm not sure what applies here. Section 5.3.4 talks about loading constraints, but they seem not to apply for annotations. The question I'm asking is because code like this: Class<?> fooClass = //will in some way obtain a reference to class Foo fooClass.getAnnotation(SomeAnnotation.class); will fail in the presence of different