/** Look in the map to see if the given constructor is part of a * call cycle. */ private void checkCyclicConstructor(JCClassDecl tree, Symbol ctor, Map<Symbol,Symbol> callMap) { if (ctor != null && (ctor.flags_field & ACYCLIC) == 0) { if ((ctor.flags_field & LOCKED) != 0) { log.error(TreeInfo.diagnosticPositionFor(ctor, tree), "recursive.ctor.invocation"); } else { ctor.flags_field |= LOCKED; checkCyclicConstructor(tree, callMap.remove(ctor), callMap); ctor.flags_field &= ~LOCKED; } ctor.flags_field |= ACYCLIC; } }
/** Look in the map to see if the given constructor is part of a * call cycle. */ private void checkCyclicConstructor(JCClassDecl tree, Symbol ctor, Map<Symbol,Symbol> callMap) { if (ctor != null && (ctor.flags_field & ACYCLIC) == 0) { if ((ctor.flags_field & LOCKED) != 0) { log.error(TreeInfo.diagnosticPositionFor(ctor, tree), "recursive.ctor.invocation"); } else { ctor.flags_field |= LOCKED; checkCyclicConstructor(tree, callMap.remove(ctor), callMap); ctor.flags_field &= ~LOCKED; } ctor.flags_field |= ACYCLIC; } }
/** Look in the map to see if the given constructor is part of a * call cycle. */ private void checkCyclicConstructor(JCClassDecl tree, Symbol ctor, Map<Symbol,Symbol> callMap) { if (ctor != null && (ctor.flags_field & ACYCLIC) == 0) { if ((ctor.flags_field & LOCKED) != 0) { log.error(TreeInfo.diagnosticPositionFor(ctor, tree), "recursive.ctor.invocation"); } else { ctor.flags_field |= LOCKED; checkCyclicConstructor(tree, callMap.remove(ctor), callMap); ctor.flags_field &= ~LOCKED; } ctor.flags_field |= ACYCLIC; } }
/** Look in the map to see if the given constructor is part of a * call cycle. */ private void checkCyclicConstructor(JCClassDecl tree, Symbol ctor, Map<Symbol,Symbol> callMap) { if (ctor != null && (ctor.flags_field & ACYCLIC) == 0) { if ((ctor.flags_field & LOCKED) != 0) { log.error(TreeInfo.diagnosticPositionFor(ctor, tree), "recursive.ctor.invocation"); } else { ctor.flags_field |= LOCKED; checkCyclicConstructor(tree, callMap.remove(ctor), callMap); ctor.flags_field &= ~LOCKED; } ctor.flags_field |= ACYCLIC; } }
/** Check for cycles in the graph of constructors calling other * constructors. */ void checkCyclicConstructors(JCClassDecl tree) { Map<Symbol,Symbol> callMap = new HashMap<Symbol, Symbol>(); // enter each constructor this-call into the map for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) { JCMethodInvocation app = TreeInfo.firstConstructorCall(l.head); if (app == null) continue; JCMethodDecl meth = (JCMethodDecl) l.head; if (TreeInfo.name(app.meth) == names._this) { callMap.put(meth.sym, TreeInfo.symbol(app.meth)); } else { meth.sym.flags_field |= ACYCLIC; } } // Check for cycles in the map Symbol[] ctors = new Symbol[0]; ctors = callMap.keySet().toArray(ctors); for (Symbol caller : ctors) { checkCyclicConstructor(tree, caller, callMap); } }
/** Check for cycles in the graph of constructors calling other * constructors. */ void checkCyclicConstructors(JCClassDecl tree) { Map<Symbol,Symbol> callMap = new HashMap<Symbol, Symbol>(); // enter each constructor this-call into the map for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) { JCMethodInvocation app = TreeInfo.firstConstructorCall(l.head); if (app == null) continue; JCMethodDecl meth = (JCMethodDecl) l.head; if (TreeInfo.name(app.meth) == names._this) { callMap.put(meth.sym, TreeInfo.symbol(app.meth)); } else { meth.sym.flags_field |= ACYCLIC; } } // Check for cycles in the map Symbol[] ctors = new Symbol[0]; ctors = callMap.keySet().toArray(ctors); for (Symbol caller : ctors) { checkCyclicConstructor(tree, caller, callMap); } }
/** Check for cycles in the graph of constructors calling other * constructors. */ void checkCyclicConstructors(JCClassDecl tree) { Map<Symbol,Symbol> callMap = new HashMap<Symbol, Symbol>(); // enter each constructor this-call into the map for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) { JCMethodInvocation app = TreeInfo.firstConstructorCall(l.head); if (app == null) continue; JCMethodDecl meth = (JCMethodDecl) l.head; if (TreeInfo.name(app.meth) == names._this) { callMap.put(meth.sym, TreeInfo.symbol(app.meth)); } else { meth.sym.flags_field |= ACYCLIC; } } // Check for cycles in the map Symbol[] ctors = new Symbol[0]; ctors = callMap.keySet().toArray(ctors); for (Symbol caller : ctors) { checkCyclicConstructor(tree, caller, callMap); } }
/** Check for cycles in the graph of constructors calling other * constructors. */ void checkCyclicConstructors(JCClassDecl tree) { Map<Symbol,Symbol> callMap = new HashMap<Symbol, Symbol>(); // enter each constructor this-call into the map for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) { JCMethodInvocation app = TreeInfo.firstConstructorCall(l.head); if (app == null) continue; JCMethodDecl meth = (JCMethodDecl) l.head; if (TreeInfo.name(app.meth) == names._this) { callMap.put(meth.sym, TreeInfo.symbol(app.meth)); } else { meth.sym.flags_field |= ACYCLIC; } } // Check for cycles in the map Symbol[] ctors = new Symbol[0]; ctors = callMap.keySet().toArray(ctors); for (Symbol caller : ctors) { checkCyclicConstructor(tree, caller, callMap); } }