Java Reference
In-Depth Information
If Q is a package name, then a compile-time error occurs.
If Q is a type name that names a class type (§8), then:
• If there is not exactly one accessible (§ 6.6 ) member of the class type that is a field
named Id , then a compile-time error occurs.
• Otherwise, if the single accessible member field is not a class variable (that is, it is
not declared static ), then a compile-time error occurs.
• Otherwise, if the class variable is declared final , then Q.Id denotes the value of the
class variable.
The type of the expression Q.Id is the declared type of the class variable after cap-
ture conversion (§ 5.1.10 ) .
If Q.Id appears in a context that requires a variable and not a value, then a
compile-time error occurs.
• Otherwise, Q.Id denotes the class variable.
The type of the expression Q.Id is the declared type of the class variable after cap-
ture conversion (§ 5.1.10 ) .
Note that this clause covers the use of enum constants (§ 8.9 ), since these always
have a corresponding final class variable.
If Q is a type name that names an interface type (§9), then:
• If there is not exactly one accessible (§ 6.6 ) member of the interface type that is a
field named Id , then a compile-time error occurs.
• Otherwise, Q.Id denotes the value of the field.
The type of the expression Q.Id is the declared type of the field after capture con-
version (§ 5.1.10 ) .
If Q.Id appears in a context that requires a variable and not a value, then a
compile-time error occurs.
If Q is an expression name, let T be the type of the expression Q :
• If T is not a reference type, a compile-time error occurs.
• If there is not exactly one accessible (§ 6.6 ) member of the type T that is a field
named Id , then a compile-time error occurs.
• Otherwise, if this field is any of the following:
♦ A field of an interface type
Search WWH ::




Custom Search