Java Reference
In-Depth Information
• Otherwise, if a field of that name is declared in the compilation unit (§ 7.3 ) contain-
ing the Identifier by a single-static-import declaration (§ 7.5.3 ) , or by a static-
import-on-demand declaration (§ 7.5.4 ) then the AmbiguousName is reclassified as
an ExpressionName .
• Otherwise, if the Identifier appears within the scope (§ 6.3 ) of a top level class (§8)
or interface type declaration (§9), a local class declaration (§ 14.3 ) or member type
declaration (§ 8.5 , § 9.5 ) with that name, then the AmbiguousName is reclassified as
a TypeName .
• Otherwise, if a type of that name is declared in the compilation unit (§ 7.3 ) contain-
ing the Identifier , either by a single-type-import declaration (§ 7.5.1 ) , or by a type-
import-on-demand declaration (§ 7.5.2 ) , or by a single-static-import declaration
7.5.3 ) , or by a static-import-on-demand declaration (§ 7.5.4 ) , then the Ambigu-
ousName is reclassified as a TypeName .
• Otherwise, the AmbiguousName is reclassified as a PackageName . A later step de-
termines whether or not a package of that name actually exists.
If the AmbiguousName is a qualified name, consisting of a name, a “ . ”, and an Identifier ,
then the name to the left of the “ . ” is first reclassified, for it is itself an AmbiguousName .
There is then a choice:
• If the name to the left of the “ . ” is reclassified as a PackageName , then:
♦ If there is a package whose name is the name to the left of the “ . ” and that
package contains a declaration of a type whose name is the same as the Identi-
fier , then this AmbiguousName is reclassified as a TypeName .
♦ Otherwise, this AmbiguousName is reclassified as a PackageName . A later
step determines whether or not a package of that name actually exists.
• If the name to the left of the “ . ” is reclassified as a TypeName , then:
♦ If the Identifier is the name of a method or field of the type denoted by
TypeName , this AmbiguousName is reclassified as an ExpressionName .
♦ Otherwise, if the Identifier is the name of a member type of the type denoted
by TypeName , this AmbiguousName is reclassified as a TypeName .
♦ Otherwise, a compile-time error occurs.
• If the name to the left of the “ . ” is reclassified as an ExpressionName , then let T be
the type of the expression denoted by ExpressionName .
♦ If the Identifier is the name of a method or field of the type denoted by T , this
AmbiguousName is reclassified as an ExpressionName .
Search WWH ::




Custom Search