Is this code valid?
public abstract class A {
protected static final String c = \"my const\";
}
@myAnnotation(value=A.c)
public class B extends A {
}
>
Thanks to the comment from @adranale I found a different answer in the Java Language Specification section on Access Control. I don't think it should work this way, but the relevant text regarding "protected" reads
Let C be the class in which a protected member m is declared. Access is permitted only within the body of a subclass S of C.
The body of a class is all the code in curly brackets. Class anotations are outside the curly brackets, so they don't have access. Interestingly, this logic would not apply to method, parameter, field or local variable annotations which are inside the class body.