6.5.2
Reclassification of Contextually Ambiguous Names
NAMES
N
Otherwise, if a type of that name is declared by more than one type import
on demand declaration of the compilation unit containing the
Identifier
,
then a compile time error results.
N
Otherwise, the
AmbiguousName
is reclassified as a
PackageName
. A later
step determines 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:
N
If the name to the left of the
.
is reclassified as a
PackageName
, then there
is a further choice:
O
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
Identifier
, then this
AmbiguousName
is reclassified as a
TypeName
.
O
Otherwise, this
AmbiguousName
is reclassified as a
PackageName
. A
later step determines whether or not a package of that name actually
exists.
N
If the name to the left of the
.
is reclassified as a
TypeName
, then this
AmbiguousName
is reclassified as an
ExpressionName
.
N
If the name to the left of the
.
is reclassified as an
ExpressionName
, then
this
AmbiguousName
is reclassified as an
ExpressionName
.
As an example, consider the following contrived library code :
package ORG.rpgpoet;
import java.util.Random;
interface Music { Random[] wizards = new Random[4]; }
and then consider this example code in another package:
package bazola;
class Gabriel {
static int n = ORG.rpgpoet.Music.wizards.length;
}
First of all, the name
ORG.rpgpoet.Music.wizards.length
is classified as an
ExpressionName
because it functions as a
PostfixExpression
. Therefore, each of
the names:
ORG.rpgpoet.Music.wizards
ORG.rpgpoet.Music
92
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