public void visitTopLevel(JCCompilationUnit tree) { if (tree.starImportScope.elems != null) { // we must have already processed this toplevel return; } // check that no class exists with same fully qualified name as // toplevel package if (checkClash && tree.pid != null) { Symbol p = tree.packge; while (p.owner != syms.rootPackage) { p.owner.complete(); // enter all class members of p if (syms.classes.get(p.getQualifiedName()) != null) { log.error(tree.pos, "pkg.clashes.with.class.of.same.name", p); } p = p.owner; } } // process package annotations annotateLater(tree.packageAnnotations, env, tree.packge); // Import-on-demand java.lang. importAll(tree.pos, reader.enterPackage(names.java_lang), env); // Process all import clauses. memberEnter(tree.defs, env); }
public void visitTopLevel(JCCompilationUnit tree) { if (tree.starImportScope.elems != null) { // we must have already processed this toplevel return; } // check that no class exists with same fully qualified name as // toplevel package if (checkClash && tree.pid != null) { Symbol p = tree.packge; while (p.owner != syms.rootPackage) { p.owner.complete(); // enter all class members of p if (syms.classes.get(p.getQualifiedName()) != null) { log.error(tree.pos, "pkg.clashes.with.class.of.same.name", p); } p = p.owner; } } // process package annotations annotateLater(tree.packageAnnotations, env, tree.packge); // Import-on-demand java.lang. importAll(tree.pos, reader.enterPackage(names.java_lang), env); // Process all import clauses. memberEnter(tree.defs, env); }
annotateLater(tree.packageAnnotations, env, tree.packge, null);
annotateLater(tree.packageAnnotations, env, tree.packge, null);
public void visitVarDef(JCVariableDecl tree) { Env<AttrContext> localEnv = env; if ((tree.mods.flags & STATIC) != 0 || (env.info.scope.owner.flags() & INTERFACE) != 0) { localEnv = env.dup(tree, env.info.dup()); localEnv.info.staticLevel++; } attr.attribType(tree.vartype, localEnv); Scope enclScope = enter.enterScope(env); VarSymbol v = new VarSymbol(0, tree.name, tree.vartype.type, enclScope.owner); v.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, v, tree); tree.sym = v; if (tree.init != null) { v.flags_field |= HASINIT; if ((v.flags_field & FINAL) != 0 && tree.init.tag != JCTree.NEWCLASS) v.setLazyConstValue(initEnv(tree, env), log, attr, tree.init); } if (chk.checkUnique(tree.pos(), v, enclScope)) { chk.checkTransparentVar(tree.pos(), v, enclScope); enclScope.enter(v); } annotateLater(tree.mods.annotations, localEnv, v); v.pos = tree.pos; }
public void visitMethodDef(JCMethodDecl tree) { Scope enclScope = enter.enterScope(env); MethodSymbol m = new MethodSymbol(0, tree.name, null, enclScope.owner); m.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, m, tree); tree.sym = m; Env<AttrContext> localEnv = methodEnv(tree, env); // Compute the method type m.type = signature(tree.typarams, tree.params, tree.restype, tree.thrown, localEnv); // Set m.params ListBuffer<VarSymbol> params = new ListBuffer<VarSymbol>(); JCVariableDecl lastParam = null; for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) { JCVariableDecl param = lastParam = l.head; assert param.sym != null; params.append(param.sym); } m.params = params.toList(); // mark the method varargs, if necessary if (lastParam != null && (lastParam.mods.flags & Flags.VARARGS) != 0) m.flags_field |= Flags.VARARGS; localEnv.info.scope.leave(); if (chk.checkUnique(tree.pos(), m, enclScope)) { enclScope.enter(m); } annotateLater(tree.mods.annotations, localEnv, m); if (tree.defaultValue != null) annotateDefaultValueLater(tree.defaultValue, localEnv, m); }
public void visitVarDef(JCVariableDecl tree) { Env<AttrContext> localEnv = env; if ((tree.mods.flags & STATIC) != 0 || (env.info.scope.owner.flags() & INTERFACE) != 0) { localEnv = env.dup(tree, env.info.dup()); localEnv.info.staticLevel++; } attr.attribType(tree.vartype, localEnv); Scope enclScope = enter.enterScope(env); VarSymbol v = new VarSymbol(0, tree.name, tree.vartype.type, enclScope.owner); v.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, v, tree); tree.sym = v; if (tree.init != null) { v.flags_field |= HASINIT; if ((v.flags_field & FINAL) != 0 && tree.init.getTag() != JCTree.NEWCLASS) v.setLazyConstValue(initEnv(tree, env), log, attr, tree.init); } if (chk.checkUnique(tree.pos(), v, enclScope)) { chk.checkTransparentVar(tree.pos(), v, enclScope); enclScope.enter(v); } annotateLater(tree.mods.annotations, localEnv, v); v.pos = tree.pos; }
public void visitMethodDef(JCMethodDecl tree) { Scope enclScope = enter.enterScope(env); MethodSymbol m = new MethodSymbol(0, tree.name, null, enclScope.owner); m.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, m, tree); tree.sym = m; Env<AttrContext> localEnv = methodEnv(tree, env); // Compute the method type m.type = signature(tree.typarams, tree.params, tree.restype, tree.thrown, localEnv); // Set m.params ListBuffer<VarSymbol> params = new ListBuffer<VarSymbol>(); JCVariableDecl lastParam = null; for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) { JCVariableDecl param = lastParam = l.head; assert param.sym != null; params.append(param.sym); } m.params = params.toList(); // mark the method varargs, if necessary if (lastParam != null && (lastParam.mods.flags & Flags.VARARGS) != 0) m.flags_field |= Flags.VARARGS; localEnv.info.scope.leave(); if (chk.checkUnique(tree.pos(), m, enclScope)) { enclScope.enter(m); } annotateLater(tree.mods.annotations, localEnv, m); if (tree.defaultValue != null) annotateDefaultValueLater(tree.defaultValue, localEnv, m); }
annotateLater(tree.mods.annotations, localEnv, m, tree.pos());
annotateLater(tree.mods.annotations, localEnv, m, tree.pos());
enclScope.enter(v); annotateLater(tree.mods.annotations, localEnv, v, tree.pos()); typeAnnotate(tree.vartype, env, v, tree.pos()); v.pos = tree.pos;
enclScope.enter(v); annotateLater(tree.mods.annotations, localEnv, v, tree.pos()); typeAnnotate(tree.vartype, env, v, tree.pos()); v.pos = tree.pos;
if (hasDeprecatedAnnotation(tree.mods.annotations)) c.flags_field |= DEPRECATED; annotateLater(tree.mods.annotations, baseEnv, c);
if (hasDeprecatedAnnotation(tree.mods.annotations)) c.flags_field |= DEPRECATED; annotateLater(tree.mods.annotations, baseEnv, c);
if (hasDeprecatedAnnotation(tree.mods.annotations)) c.flags_field |= DEPRECATED; annotateLater(tree.mods.annotations, baseEnv, c, tree.pos());
if (hasDeprecatedAnnotation(tree.mods.annotations)) c.flags_field |= DEPRECATED; annotateLater(tree.mods.annotations, baseEnv, c, tree.pos());