| java.lang.Object sun.tools.java.Imports
Imports | public class Imports implements Constants(Code) | | This class describes the classes and packages imported
from a source file. A Hashtable called bindings is maintained
to quickly map symbol names to classes. This table is flushed
everytime a new import is added.
A class name is resolved as follows:
- if it is a qualified name then return the corresponding class
- if the name corresponds to an individually imported class then return that class
- check if the class is defined in any of the imported packages,
if it is then return it, make sure it is defined in only one package
- assume that the class is defined in the current package
WARNING: The contents of this source file are not part of any
supported API. Code that depends on them does so at its own risk:
they are subject to change or removal without notice.
|
checked | protected int checked(Code) | | Are the import names checked yet?
|
classes | Hashtable classes(Code) | | The imported classes, including memoized imports from packages.
|
currentPackage | Identifier currentPackage(Code) | | The current package, which is implicitly imported,
and has precedence over other imported packages.
|
currentPackageWhere | long currentPackageWhere(Code) | | A location for the current package declaration. Used to
report errors against the current package.
|
packages | Vector packages(Code) | | The imported package identifiers. This will not contain duplicate
imports for the same package. It will also not contain the
current package.
|
singles | Vector singles(Code) | | The (originally) imported classes.
A vector of IdentifierToken.
|
addPackage | public synchronized void addPackage(IdentifierToken t)(Code) | | Add a package import, or perhaps an inner class scope.
Ignore any duplicate imports.
|
forceResolve | public synchronized Identifier forceResolve(Environment env, Identifier nm)(Code) | | Suppose a resolve() call has failed.
This routine can be used silently to give a reasonable
default qualification (the current package) to the identifier.
This decision is recorded for future reference.
|
getCurrentPackage | public Identifier getCurrentPackage()(Code) | | Report the current package
|
getImportedClasses | public List getImportedClasses()(Code) | | Return an unmodifiable list of IdentifierToken representing
classes specified as imports.
|
getImportedPackages | public List getImportedPackages()(Code) | | Return an unmodifiable list of IdentifierToken representing
packages specified as imports.
|
importable | public static boolean importable(Identifier id, Environment env)(Code) | | Check to see if 'id' names an importable class in `env'.
This method was made public and static for utility.
|
resolve | public synchronized void resolve(Environment env)(Code) | | Check the names of the imports.
|
resolve | public synchronized Identifier resolve(Environment env, Identifier nm) throws ClassNotFound(Code) | | Lookup a class, given the current set of imports,
AmbiguousClass exception is thrown if the name can be
resolved in more than one way. A ClassNotFound exception
is thrown if the class is not found in the imported classes
and packages.
|
setCurrentPackage | public synchronized void setCurrentPackage(IdentifierToken t)(Code) | | Specify the current package with an IdentifierToken.
|
setCurrentPackage | public synchronized void setCurrentPackage(Identifier id)(Code) | | Specify the current package
|
|
|