Home » openjdk-7 » com.sun.tools » javac » comp » [javadoc | source]
public class: Enter [javadoc | source]

Direct Known Subclasses:

This class enters symbols for all encountered definitions into the symbol table. The pass consists of two phases, organized as follows:

In the first phase, all class symbols are intered 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.

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 (1) determination of a class's parameters, supertype and interfaces, as well as (2) entering all symbols defined in the class into its scope, with the exception of class symbols which have been entered in phase 1. (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)

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.
Field Summary
protected static final  Key<Enter> enterKey     
 Log log     
 Symtab syms     
 Check chk     
 TreeMaker make     
 ClassReader reader     
 Annotate annotate     
 MemberEnter memberEnter     
 Types types     
 Lint lint     
 Names names     
 JavaFileManager fileManager     
 PkgInfo pkginfoOpt     
 Map<AttrContext> typeEnvs    A hashtable mapping classes and packages to the environments current at the points of their definitions. 
 ListBuffer<ClassSymbol> uncompleted    The queue of all classes that might still need to be completed; saved and initialized by main(). 
protected  Env<AttrContext> env    Visitor argument: the current environment. 
 Type result    Visitor result: the computed type. 
 protected Enter(Context context) 
Method from com.sun.tools.javac.comp.Enter Summary:
classEnter,   classEnter,   classEnv,   complete,   duplicateClass,   enterScope,   getClassEnv,   getEnv,   getTopLevelEnv,   instance,   main,   topLevelEnv,   visitClassDef,   visitTopLevel,   visitTree,   visitTypeParameter
Methods from com.sun.tools.javac.tree.JCTree$Visitor:
visitAnnotation,   visitApply,   visitAssert,   visitAssign,   visitAssignop,   visitBinary,   visitBlock,   visitBreak,   visitCase,   visitCatch,   visitClassDef,   visitConditional,   visitContinue,   visitDoLoop,   visitErroneous,   visitExec,   visitForLoop,   visitForeachLoop,   visitIdent,   visitIf,   visitImport,   visitIndexed,   visitLabelled,   visitLetExpr,   visitLiteral,   visitMethodDef,   visitModifiers,   visitNewArray,   visitNewClass,   visitParens,   visitReturn,   visitSelect,   visitSkip,   visitSwitch,   visitSynchronized,   visitThrow,   visitTopLevel,   visitTree,   visitTry,   visitTypeApply,   visitTypeArray,   visitTypeBoundKind,   visitTypeCast,   visitTypeIdent,   visitTypeParameter,   visitTypeTest,   visitTypeUnion,   visitUnary,   visitVarDef,   visitWhileLoop,   visitWildcard
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.sun.tools.javac.comp.Enter Detail:
 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.
 List<Type> classEnter(List<T> trees,
    Env<AttrContext> env) 
    Visitor method: enter classes of a list of trees, returning a list of types.
 public Env<AttrContext> classEnv(JCClassDecl tree,
    Env<AttrContext> 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.
 public  void complete(List<JCCompilationUnit> trees,
    ClassSymbol c) 
    Main method: enter one class from a list of toplevel trees and place the rest on uncompleted for later processing.
 protected  void duplicateClass(DiagnosticPosition pos,
    ClassSymbol c) 
    Complain about a duplicate class.
 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<AttrContext> getClassEnv(TypeSymbol sym) 
 public Env<AttrContext> getEnv(TypeSymbol sym) 
    Accessor for typeEnvs
 public Env<AttrContext> getTopLevelEnv(JCCompilationUnit tree) 
 public static Enter instance(Context context) 
 public  void main(List<JCCompilationUnit> trees) 
    Main method: enter all classes in a list of toplevel trees.
 Env<AttrContext> topLevelEnv(JCCompilationUnit tree) 
    Create a fresh environment for toplevels.
 public  void visitClassDef(JCClassDecl tree) 
 public  void visitTopLevel(JCCompilationUnit tree) 
 public  void visitTree(JCTree tree) 
    Default class enter visitor method: do nothing.
 public  void visitTypeParameter(JCTypeParameter tree) 
    Class enter visitor method for type parameters. Enter a symbol for type parameter in local scope, after checking that it is unique.