com.sun.tools.javac.comp.Enter

This enters symbols for all encountered definitions into the symbol table. The pass consists of two phases, organized as follows:
  1. 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 MemberEnter object as completer.

  2. In addition, if any package-info.java files are found, containing package annotations, then the TopLevel tree node for the package-info.java file is put on the "to do" as well.

  3. In the second phase, classes are completed using MemberEnter.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

    (2) depends on (1) having been completed for a class and all its superclasses and enclosing classes. That's why, after doing (1), we put classes in a `halfcompleted' queue. Only when we have performed (1) for a class and all it's superclasses and enclosing classes, we proceed to (2).

Whereas the first phase is organized as a sweep through all compiled syntax trees, the second phase is 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 member-enter phase for the corresponding class tree.

Classes migrate from one phase to the next via queues:

    class enter -> (Enter.uncompleted)         --> member enter (1)
 		-> (MemberEnter.halfcompleted) --> member enter (2)
 		-> (Todo)	               --> attribute
 						(only for toplevel classes)