Java Reference
In-Depth Information
6.5.3. Meaning of Package Names
The meaning of a name classified as a
PackageName
is determined as follows.
6.5.3.1. Simple Package Names
If a package name consists of a single
Identifier
, then this identifier denotes a top level
package named by that identifier.
If no top level package of that name is in scope (§
6.3
), then a compile-time error occurs.
6.5.3.2. Qualified Package Names
If a package name is of the form
Q.Id
, then
Q
must also be a package name. The package
name
Q.Id
names a package that is the member named
Id
within the package named by
Q
.
If
Q
does not name an observable package (§
7.4.3
), or
Id
is not the simple name of an ob-
servable subpackage of that package, then a compile-time error occurs.
6.5.4. Meaning of
PackageOrTypeNames
6.5.4.1. Simple PackageOrTypeNames
If the
PackageOrTypeName
,
Q
, occurs in the scope of a type named
Q
, then the
Pack-
ageOrTypeName
is reclassified as a
TypeName
.
Otherwise, the
PackageOrTypeName
is reclassified as a
PackageName
. The meaning of
the
PackageOrTypeName
is the meaning of the reclassified name.
6.5.4.2. Qualified PackageOrTypeNames
Given a qualified
PackageOrTypeName
of the form
Q.Id
, if the type or package denoted
by
Q
has a member type named
Id
, then the qualified
PackageOrTypeName
name is reclas-
sified as a
TypeName
.
Otherwise, it is reclassified as a
PackageName
. The meaning of the qualified
Pack-
ageOrTypeName
is the meaning of the reclassified name.
6.5.5. Meaning of Type Names
The meaning of a name classified as a
TypeName
is determined as follows.
6.5.5.1. Simple Type Names
If a type name consists of a single
Identifier
, then the identifier must occur in the scope
of exactly one visible declaration of a type with this name, or a compile-time error occurs.
The meaning of the type name is that type.