Java Reference
In-Depth Information
For example, given the code:
class Foo<T> {
public static int classVar = 42;
}
the following assignment is illegal:
Foo<String>.classVar = 91; // illegal
Instead, one writes
Foo.classVar = 91;
This does not restrict the Java programming language in any meaningful way. Type
parameters may not be used in the types of static variables, and so the type arguments
of a parameterized type can never influence the type of a static variable. Therefore, no
expressive power is lost. Technically, the type name
Foo
above is a raw type, but this
use of raw types is harmless, and does not give rise to warnings
6.5.7. Meaning of Method Names
The meaning of a name classified as a
MethodName
is determined as follows.
6.5.7.1. Simple Method Names
A simple method name may appear as the element name in an element-value pair. In that
case, the
Identifier
in an
ElementValuePair
must be the simple name of one of the elements
of the annotation type identified by
TypeName
in the containing annotation, or a compile-
time error occurs.
In other words, the identifier in an element-value pair must also be a method name in
the interface identified by
TypeName
.
Otherwise, a simple method name necessarily appears in the context of a method invoca-
tion expression. In that case, if a method name consists of a single
Identifier
, then
Identifier
is the method name to be used for method invocation.
The
Identifier
must name at least one method that is visible at the point where the
Identifier
6.5.7.2. Qualified Method Names
A qualified method name can only appear in the context of a method invocation expression.