void attribBounds(List<JCTypeParameter> typarams) { for (JCTypeParameter typaram : typarams) { Type bound = typaram.type.getUpperBound(); if (bound != null && bound.tsym instanceof ClassSymbol) { ClassSymbol c = (ClassSymbol)bound.tsym; if ((c.flags_field & COMPOUND) != 0) { assert (c.flags_field & UNATTRIBUTED) != 0 : c; attribClass(typaram.pos(), c); } } } }
attribClass((ClassSymbol)st.tsym); attribClass((ClassSymbol)c.owner);
void attribBounds(List<JCTypeParameter> typarams) { for (JCTypeParameter typaram : typarams) { Type bound = typaram.type.getUpperBound(); if (bound != null && bound.tsym instanceof ClassSymbol) { ClassSymbol c = (ClassSymbol)bound.tsym; if ((c.flags_field & COMPOUND) != 0) { assert (c.flags_field & UNATTRIBUTED) != 0 : c; attribClass(typaram.pos(), c); } } } }
attribClass((ClassSymbol)st.tsym); attribClass((ClassSymbol)c.owner);
/** Main method: attribute class definition associated with given class symbol. * reporting completion failures at the given position. * @param pos The source position at which completion errors are to be * reported. * @param c The class symbol whose definition will be attributed. */ public void attribClass(DiagnosticPosition pos, ClassSymbol c) { try { annotate.flush(); attribClass(c); } catch (CompletionFailure ex) { chk.completionError(pos, ex); } }
/** Main method: attribute class definition associated with given class symbol. * reporting completion failures at the given position. * @param pos The source position at which completion errors are to be * reported. * @param c The class symbol whose definition will be attributed. */ public void attribClass(DiagnosticPosition pos, ClassSymbol c) { try { annotate.flush(); attribClass(c); } catch (CompletionFailure ex) { chk.completionError(pos, ex); } }
/** Main method: attribute class definition associated with given class symbol. * reporting completion failures at the given position. * @param pos The source position at which completion errors are to be * reported. * @param c The class symbol whose definition will be attributed. */ public void attribClass(DiagnosticPosition pos, ClassSymbol c) { try { annotate.flush(); attribClass(c); } catch (CompletionFailure ex) { chk.completionError(pos, ex); } }
/** Main method: attribute class definition associated with given class symbol. * reporting completion failures at the given position. * @param pos The source position at which completion errors are to be * reported. * @param c The class symbol whose definition will be attributed. */ public void attribClass(DiagnosticPosition pos, ClassSymbol c) { try { annotate.flush(); attribClass(c); } catch (CompletionFailure ex) { chk.completionError(pos, ex); } }
/** * Attribute an env for either a top level tree or class declaration. */ public void attrib(Env<AttrContext> env) { if (env.tree.hasTag(TOPLEVEL)) attribTopLevel(env); else attribClass(env.tree.pos(), env.enclClass.sym); }
/** * Attribute an env for either a top level tree or class declaration. */ public void attrib(Env<AttrContext> env) { if (env.tree.hasTag(TOPLEVEL)) attribTopLevel(env); else attribClass(env.tree.pos(), env.enclClass.sym); }
public void visitClassDef(JCClassDecl tree) { // Local classes have not been entered yet, so we need to do it now: if ((env.info.scope.owner.kind & (VAR | MTH)) != 0) enter.classEnter(tree, env); ClassSymbol c = tree.sym; if (c == null) { // exit in case something drastic went wrong during enter. result = null; } else { // make sure class has been completed: c.complete(); // If this class appears as an anonymous class // in a superclass constructor call where // no explicit outer instance is given, // disable implicit outer instance from being passed. // (This would be an illegal access to "this before super"). if (env.info.isSelfCall && env.tree.tag == JCTree.NEWCLASS && ((JCNewClass) env.tree).encl == null) { c.flags_field |= NOOUTERTHIS; } attribClass(tree.pos(), c); result = tree.type = c.type; } }
public void visitClassDef(JCClassDecl tree) { // Local classes have not been entered yet, so we need to do it now: if ((env.info.scope.owner.kind & (VAR | MTH)) != 0) enter.classEnter(tree, env); ClassSymbol c = tree.sym; if (c == null) { // exit in case something drastic went wrong during enter. result = null; } else { // make sure class has been completed: c.complete(); // If this class appears as an anonymous class // in a superclass constructor call where // no explicit outer instance is given, // disable implicit outer instance from being passed. // (This would be an illegal access to "this before super"). if (env.info.isSelfCall && env.tree.getTag() == JCTree.NEWCLASS && ((JCNewClass) env.tree).encl == null) { c.flags_field |= NOOUTERTHIS; } attribClass(tree.pos(), c); result = tree.type = c.type; } }
public void visitClassDef(JCClassDecl tree) { // Local classes have not been entered yet, so we need to do it now: if ((env.info.scope.owner.kind & (VAR | MTH)) != 0) enter.classEnter(tree, env); ClassSymbol c = tree.sym; if (c == null) { // exit in case something drastic went wrong during enter. result = null; } else { // make sure class has been completed: c.complete(); // If this class appears as an anonymous class // in a superclass constructor call where // no explicit outer instance is given, // disable implicit outer instance from being passed. // (This would be an illegal access to "this before super"). if (env.info.isSelfCall && env.tree.hasTag(NEWCLASS) && ((JCNewClass) env.tree).encl == null) { c.flags_field |= NOOUTERTHIS; } attribClass(tree.pos(), c); result = tree.type = c.type; } }
/** * Attribute a parse tree. * @returns the attributed parse tree */ public Env<AttrContext> attribute(Env<AttrContext> env) { if (verboseCompilePolicy) log.printLines(log.noticeWriter, "[attribute " + env.enclClass.sym + "]"); if (verbose) printVerbose("checking.attribution", env.enclClass.sym); if (taskListener != null) { TaskEvent e = new TaskEvent(TaskEvent.Kind.ANALYZE, env.toplevel, env.enclClass.sym); taskListener.started(e); } JavaFileObject prev = log.useSource( env.enclClass.sym.sourcefile != null ? env.enclClass.sym.sourcefile : env.toplevel.sourcefile); try { attr.attribClass(env.tree.pos(), env.enclClass.sym); } finally { log.useSource(prev); } return env; }
public Symbol getElement(TreePath path) { JCTree tree = (JCTree) path.getLeaf(); Symbol sym = TreeInfo.symbolFor(tree); if (sym == null) { if (TreeInfo.isDeclaration(tree)) { for (TreePath p = path; p != null; p = p.getParentPath()) { JCTree t = (JCTree) p.getLeaf(); if (t.hasTag(JCTree.Tag.CLASSDEF)) { JCClassDecl ct = (JCClassDecl) t; if (ct.sym != null) { if ((ct.sym.flags_field & Flags.UNATTRIBUTED) != 0) { attr.attribClass(ct.pos(), ct.sym); sym = TreeInfo.symbolFor(tree); } break; } } } } } return sym; }
public Symbol getElement(TreePath path) { JCTree tree = (JCTree) path.getLeaf(); Symbol sym = TreeInfo.symbolFor(tree); if (sym == null) { if (TreeInfo.isDeclaration(tree)) { for (TreePath p = path; p != null; p = p.getParentPath()) { JCTree t = (JCTree) p.getLeaf(); if (t.hasTag(JCTree.Tag.CLASSDEF)) { JCClassDecl ct = (JCClassDecl) t; if (ct.sym != null) { if ((ct.sym.flags_field & Flags.UNATTRIBUTED) != 0) { attr.attribClass(ct.pos(), ct.sym); sym = TreeInfo.symbolFor(tree); } break; } } } } } return sym; }
attribClass(tree.pos(), c); result = tree.type = c.type;
/** * Attribute a parse tree. * @returns the attributed parse tree */ public Env<AttrContext> attribute(Env<AttrContext> env) { if (compileStates.isDone(env, CompileState.ATTR)) return env; if (verboseCompilePolicy) log.printLines(log.noticeWriter, "[attribute " + env.enclClass.sym + "]"); if (verbose) printVerbose("checking.attribution", env.enclClass.sym); if (taskListener != null) { TaskEvent e = new TaskEvent(TaskEvent.Kind.ANALYZE, env.toplevel, env.enclClass.sym); taskListener.started(e); } JavaFileObject prev = log.useSource( env.enclClass.sym.sourcefile != null ? env.enclClass.sym.sourcefile : env.toplevel.sourcefile); try { attr.attribClass(env.tree.pos(), env.enclClass.sym); compileStates.put(env, CompileState.ATTR); } finally { log.useSource(prev); } return env; }
Env<AttrContext> cenv = enter.classEnv(cd, env); enter.typeEnvs.put(c, cenv); attribClass(c); return owntype;
Env<AttrContext> cenv = enter.classEnv(cd, env); typeEnvs.put(c, cenv); attribClass(c); return owntype;