/** * 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. * * @param tree The class definition. * @param env The environment current outside of the class definition. */ public Env<AttrContext> classEnv(JCClassDecl tree, Env<AttrContext> env) { Env<AttrContext> localEnv = env.dup(tree, env.info.dup(new Scope(tree.sym))); localEnv.enclClass = tree; localEnv.outer = env; localEnv.info.isSelfCall = false; localEnv.info.lint = null; // leave this to be filled in by Attr, // when annotations have been processed return localEnv; }
public Env dup() { Env env = new Env(); env.next = this; env.outer = this.outer; env.packge = this.packge; env.enclosingClass = this.enclosingClass; env.scope = this.scope; env.namedImports = this.namedImports; env.starImports = this.starImports; env.staticStarImports = this.staticStarImports; return env; }