Java Reference
In-Depth Information
• If a field name is shadowed by a declaration of a parameter or local variable,
then the name of the parameter or local variable can be changed without af-
fecting other code.
Obscuring involving constant names is rare:
• Constant names normally have no lowercase letters, so they will not nor-
mally obscure names of packages or types, nor will they normally shadow
fields, whose names typically contain at least one lowercase letter.
• Constant names cannot obscure method names, because they are distin-
guished syntactically.
6.5. Determining the Meaning of a Name
The meaning of a name depends on the context in which it is used. The determination of
the meaning of a name requires three steps:
• First, context causes a name syntactically to fall into one of six categories: Pack-
ageName , TypeName , ExpressionName , MethodName , PackageOrTypeName , or
AmbiguousName .
• Second, a name that is initially classified by its context as an AmbiguousName or
as a PackageOrTypeName is then reclassified to be a PackageName , TypeName ,
or ExpressionName .
• Third, the resulting category then dictates the final determination of the meaning of
the name (or a compile-time error if the name has no meaning).
PackageName:
Identifier
PackageName . Identifier
TypeName:
Identifier
PackageOrTypeName . Identifier
ExpressionName:
Identifier
AmbiguousName . Identifier
MethodName:
Identifier
AmbiguousName . Identifier
PackageOrTypeName:
Identifier
Search WWH ::




Custom Search