Java Reference
In-Depth Information
PackageOrTypeName . Identifier
AmbiguousName:
Identifier
AmbiguousName . Identifier
The use of context helps to minimize name conflicts between entities of different
kinds. Such conflicts will be rare if the naming conventions described in §
6.1
are fol-
lowed. Nevertheless, conflicts may arise unintentionally as types developed by differ-
ent programmers or different organizations evolve. For example, types, methods, and
fields may have the same name. It is always possible to distinguish between a meth-
od and a field with the same name, since the context of a use always tells whether a
method is intended.
6.5.1. Syntactic Classification of a Name According to Context
A name is syntactically classified as a
PackageName
in these contexts:
• In a package declaration (§
7.4
)
• To the left of the “
.
” in a qualified
PackageName
A name is syntactically classified as a
TypeName
in these contexts:
• In a single-type-import declaration (§
7.5.1
)
• In a type argument list (§
4.5.1
) of a parameterized type
• In an explicit type argument list in a method or constructor invocation
• As a
Type
(or the part of a
Type
that remains after all brackets are deleted) in any
of the following contexts: