I cleaned up the code and changed all access to the static member so that it would be qualified by the class in which they are defined. This, however, leads to the next problem that puzzles me.
I have a class with a nested class inside. In the annotation of this nested class, I refer to a private static final field in the surrounding class. When doing this without qualification (as in the annotation to class D below), this works. However, when adding a class qualifier (as in the annotation for class C), the compiler reports that the field (v below) is not visible.
public class VisibilityTest { @interface A { int f(); } @A(f = VisibilityTest.v)
In both cases, the variable refers to one field, so why is this happening?
source share