In the first phase, all class symbols are entered into their enclosing scope, descending recursively down the tree for classes which are members of other classes. The class symbols are given a TypeEnter object as completer.
In the second phase classes are completed using TypeEnter.complete(). Completion might occur on demand, but any classes that are not completed that way will be eventually completed by processing the `uncompleted' queue. Completion entails determination of a class's parameters, supertype and interfaces, as well as entering all symbols defined in the class into its scope, with the exception of class symbols which have been entered in phase 1.
Whereas the first phase is organized as a sweep through all compiled syntax trees, the second phase is on-demand. Members of a class are entered when the contents of a class are first accessed. This is accomplished by installing completer objects in class symbols for compiled classes which invoke the type-enter phase for the corresponding class tree.
Classes migrate from one phase to the next via queues:
class enter -> (Enter.uncompleted) --> type enter
-> (Todo) --> attribute
(only for toplevel classes)
This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv Annotate | |
| pack-priv Check | |
| pack-priv JCDiagnostic. | |
| protected static final Context. | |
| protected Env | env
Visitor argument: the current environment. |
| pack-priv JavaFileManager | |
| pack-priv Lint | |
| pack-priv Log | |
| pack-priv TreeMaker | |
| pack-priv Modules | |
| pack-priv Names | |
| pack-priv List | pendingCompleter
The queue of classes that should have typeEnter completer installed after all the classes are discovered. |
| pack-priv Option. | |
| private JCTree. | predefClassDef
A dummy class to serve as enclClass for toplevel environments. |
| pack-priv Type | result
Visitor result: the computed type. |
| private final TreeScanner | |
| pack-priv Symtab | |
| private final Todo | |
| pack-priv TypeEnter | |
| pack-priv TypeEnvs | |
| pack-priv Types | |
| pack-priv ListBuffer | uncompleted
The queue of all classes that might still need to be completed; saved and initialized by main(). |
| pack-priv ListBuffer | unfinishedModules
The queue of modules whose imports still need to be checked. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv Type | classEnter(JCTree
The tree to be visited. tree, Env<AttrContext> The environment visitor argument. env)Visitor method: enter all classes in given tree, catching any completion failure exceptions. |
| pack-priv <T extends JCTree> List | classEnter(List<T> trees, Env<AttrContext> env)
Visitor method: enter classes of a list of trees, returning a list of types. |
| public Env | classEnv(JCTree.
The class definition. tree,The environment current outside of the class definition. env)Create a fresh environment for class bodies. |
| private static boolean | classNameMatchesFileName(Symbol.
Does class have the same name as the file it appears in? |
| public void | complete(List<JCTree.
The list of trees to be processed. trees,The class symbol to be processed or null to process all. cMain method: enter classes from the list of toplevel trees, possibly skipping TypeEnter for all but 'c' by placing them on the uncompleted list. |
| protected void | duplicateClass(JCDiagnostic.
Complain about a duplicate class. |
| pack-priv Scope. | enterScope(Env<AttrContext> env)
The scope in which a member definition in environment env is to be entered This is usually the environment's scope, except for class environments, where the local scope is for type variables, and the this and super symbol only, and members go into the class member scope. |
| public Env | |
| public Env | |
| public Iterable | |
| public Env | |
| public static Enter | |
| public void | main(List<JCTree.
The list of trees to be processed. treesMain method: enter all classes in a list of toplevel trees. |
| public Env | moduleEnv(JCTree.
The module definition. tree,The environment current outside of the module definition. env)Create a fresh environment for modules. |
| public void | |
| pack-priv Env | topLevelEnv(JCTree.
The toplevel tree. treeCreate a fresh environment for toplevels. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | visitTree(JCTree tree)
Overrides com. Default class enter visitor method: do nothing. |
| public void | visitTypeParameter(JCTree.
Overrides com. Class enter visitor method for type parameters. |
| annotate | back to summary |
|---|---|
| pack-priv Annotate annotate | |
| chk | back to summary |
|---|---|
| pack-priv Check chk | |
| diags | back to summary |
|---|---|
| pack-priv JCDiagnostic. | |
| enterKey | back to summary |
|---|---|
| protected static final Context. | |
| env | back to summary |
|---|---|
| protected Env<AttrContext> env Visitor argument: the current environment. | |
| fileManager | back to summary |
|---|---|
| pack-priv JavaFileManager fileManager | |
| lint | back to summary |
|---|---|
| pack-priv Lint lint | |
| log | back to summary |
|---|---|
| pack-priv Log log | |
| make | back to summary |
|---|---|
| pack-priv TreeMaker make | |
| modules | back to summary |
|---|---|
| pack-priv Modules modules | |
| names | back to summary |
|---|---|
| pack-priv Names names | |
| pendingCompleter | back to summary |
|---|---|
| pack-priv List<Symbol. The queue of classes that should have typeEnter completer installed after all the classes are discovered. | |
| pkginfoOpt | back to summary |
|---|---|
| pack-priv Option. | |
| predefClassDef | back to summary |
|---|---|
| private JCTree. A dummy class to serve as enclClass for toplevel environments. | |
| result | back to summary |
|---|---|
| pack-priv Type result Visitor result: the computed type. | |
| setPackageSymbols | back to summary |
|---|---|
| private final TreeScanner setPackageSymbols | |
| syms | back to summary |
|---|---|
| pack-priv Symtab syms | |
| todo | back to summary |
|---|---|
| private final Todo todo | |
| typeEnter | back to summary |
|---|---|
| pack-priv TypeEnter typeEnter | |
| typeEnvs | back to summary |
|---|---|
| pack-priv TypeEnvs typeEnvs | |
| types | back to summary |
|---|---|
| pack-priv Types types | |
| uncompleted | back to summary |
|---|---|
| pack-priv ListBuffer<Symbol. The queue of all classes that might still need to be completed; saved and initialized by main(). | |
| unfinishedModules | back to summary |
|---|---|
| pack-priv ListBuffer<JCTree. The queue of modules whose imports still need to be checked. | |
| Enter | back to summary |
|---|---|
protected Enter(Context context)
| |
| classEnter | back to summary |
|---|---|
| pack-priv Type classEnter(JCTree tree, Env<AttrContext> env) Visitor method: enter all classes in given tree, catching any completion failure exceptions. Return the tree's type.
| |
| classEnter | back to summary |
|---|---|
| pack-priv <T extends JCTree> List Visitor method: enter classes of a list of trees, returning a list of types. | |
| classEnv | back to summary |
|---|---|
| public Env Create a fresh environment for class bodies. This will create a fresh scope for local symbols of a class, referred to by the environments info.scope field. This scope will contain - symbols for this and super - symbols for any type parameters In addition, it serves as an anchor for scopes of methods and initializers which are nested in this scope via Scope.dup(). This scope should not be confused with the members scope of a class.
| |
| classNameMatchesFileName | back to summary |
|---|---|
| private static boolean classNameMatchesFileName(Symbol. Does class have the same name as the file it appears in? | |
| complete | back to summary |
|---|---|
| public void complete(List<JCTree. Main method: enter classes from the list of toplevel trees, possibly skipping TypeEnter for all but 'c' by placing them on the uncompleted list.
| |
| duplicateClass | back to summary |
|---|---|
| protected void duplicateClass(JCDiagnostic. Complain about a duplicate class. | |
| enterScope | back to summary |
|---|---|
| pack-priv Scope. The scope in which a member definition in environment env is to be entered This is usually the environment's scope, except for class environments, where the local scope is for type variables, and the this and super symbol only, and members go into the class member scope. | |
| getClassEnv | back to summary |
|---|---|
| public Env | |
| getEnv | back to summary |
|---|---|
| public Env Accessor for typeEnvs | |
| getEnvs | back to summary |
|---|---|
| public Iterable | |
| getTopLevelEnv | back to summary |
|---|---|
| public Env | |
| instance | back to summary |
|---|---|
| public static Enter instance(Context context) | |
| main | back to summary |
|---|---|
| public void main(List<JCTree. Main method: enter all classes in a list of toplevel trees.
| |
| moduleEnv | back to summary |
|---|---|
| public Env Create a fresh environment for modules.
| |
| newRound | back to summary |
|---|---|
| public void newRound() | |
| topLevelEnv | back to summary |
|---|---|
| pack-priv Env Create a fresh environment for toplevels.
| |
| unenter | back to summary |
|---|---|
| public void unenter(JCTree. | |
| visitClassDef | back to summary |
|---|---|
| public void visitClassDef(JCTree. Overrides com.
| |
| visitModuleDef | back to summary |
|---|---|
| public void visitModuleDef(JCTree. Overrides com.
| |
| visitTopLevel | back to summary |
|---|---|
| public void visitTopLevel(JCTree. Overrides com.
| |
| visitTree | back to summary |
|---|---|
| public void visitTree(JCTree tree) Overrides com. Default class enter visitor method: do nothing.
| |
| visitTypeParameter | back to summary |
|---|---|
| public void visitTypeParameter(JCTree. Overrides com. Class enter visitor method for type parameters. Enter a symbol for type parameter in local scope, after checking that it is unique.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final Symbol. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| msym | back to summary |
|---|---|
| private final Symbol. | |
| UnenterScanner | back to summary |
|---|---|
| public UnenterScanner(Symbol. | |
| visitClassDef | back to summary |
|---|---|
| public void visitClassDef(JCTree. Overrides com.
| |