Java Reference
In-Depth Information
an
ExpressionName
.
a
TypeName
.
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
.