6.5.4.1. Simple PackageOrTypeNames
If the PackageOrTypeName, Q, is a valid TypeIdentifier and occurs in the scope of a class, interface, or type parameter named Q, then the PackageOrTypeName 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 Id is a valid TypeIdentifier and the class, interface, type parameter, or package denoted by Q has a member class or interface named Id, then the qualified PackageOrTypeName name is reclassified as a TypeName.
Otherwise, it is reclassified as a PackageName. The meaning of the qualified PackageOrTypeName is the meaning of the reclassified name.