NAMES
Reclassification of Contextually Ambiguous Names
6.5.2
A name is syntactically classified as an
ExpressionName
in these contexts:
As the array reference expression in an array access expression ( 15.12)
As a
PostfixExpression
( 15.13)
As the left hand operand of an assignment operator ( 15.25)
A name is syntactically classified as a
MethodName
in this context:
Before the
(
in a method invocation expression ( 15.11)
A name is syntactically classified as an
AmbiguousName
in these contexts:
To the left of the
.
in a qualified
ExpressionName
To the left of the
.
in a qualified
MethodName
To the left of the
.
in a qualified
AmbiguousName
6.5.2 Reclassification of Contextually Ambiguous Names
An
AmbiguousName
is then reclassified as follows:
If the
AmbiguousName
is a simple name, consisting of a single
Identifier
:
N
If the
Identifier
appears within the scope ( 6.3) of a local variable declara
tion ( 14.3) or parameter declaration ( 8.4.1, 8.6.1, 14.18) with that
name, then the
AmbiguousName
is reclassified as an
ExpressionName
.
N
Otherwise, consider the class or interface
C
within whose declaration the
Identifier
occurs. If
C
has one or more fields with that name, which may be
either declared within it or inherited, then the
AmbiguousName
is reclassi
fied as an
ExpressionName
.
N
Otherwise, if a type of that name is declared in the compilation unit ( 7.3)
containing the
Identifier
, either by a single type import declaration ( 7.5.1)
or by a class or interface type declaration ( 7.6), then the
AmbiguousName
is reclassified as a
TypeName
.
N
Otherwise, if a type of that name is declared in another compilation unit
( 7.3) of the package ( 7.1) of the compilation unit containing the
Identifier
, then the
AmbiguousName
is reclassified as a
TypeName
.
N
Otherwise, if a type of that name is declared by exactly one type import on
demand declaration ( 7.5.2) of the compilation unit containing the
Identifier
, then the
AmbiguousName
is reclassified as a
TypeName
.
91
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved