public List<Type> analyzeLambdaThrownTypes(final Env<AttrContext> env, JCLambda that, TreeMaker make) { //we need to disable diagnostics temporarily; the problem is that if //a lambda expression contains e.g. an unreachable statement, an error //message will be reported and will cause compilation to skip the flow analyis //step - if we suppress diagnostics, we won't stop at Attr for flow-analysis //related errors, which will allow for more errors to be detected Log.DiagnosticHandler diagHandler = new Log.DiscardDiagnosticHandler(log); try { new AssignAnalyzer() { Scope enclosedSymbols = new Scope(env.enclClass.sym); @Override public void visitVarDef(JCVariableDecl tree) { enclosedSymbols.enter(tree.sym); super.visitVarDef(tree); } @Override protected boolean trackable(VarSymbol sym) { return enclosedSymbols.includes(sym) && sym.owner.kind == MTH; } }.analyzeTree(env, that); LambdaFlowAnalyzer flowAnalyzer = new LambdaFlowAnalyzer(); flowAnalyzer.analyzeTree(env, that, make); return flowAnalyzer.inferredThrownTypes; } finally { log.popDiagnosticHandler(diagHandler); } }
public List<Type> analyzeLambdaThrownTypes(Env<AttrContext> env, JCLambda that, TreeMaker make) { //we need to disable diagnostics temporarily; the problem is that if //a lambda expression contains e.g. an unreachable statement, an error //message will be reported and will cause compilation to skip the flow analyis //step - if we suppress diagnostics, we won't stop at Attr for flow-analysis //related errors, which will allow for more errors to be detected Log.DiagnosticHandler diagHandler = new Log.DiscardDiagnosticHandler(log); try { new AssignAnalyzer(log, syms, lint, names).analyzeTree(env); LambdaFlowAnalyzer flowAnalyzer = new LambdaFlowAnalyzer(); flowAnalyzer.analyzeTree(env, that, make); return flowAnalyzer.inferredThrownTypes; } finally { log.popDiagnosticHandler(diagHandler); } }
public void analyzeTree(Env<AttrContext> env, TreeMaker make) { new AliveAnalyzer().analyzeTree(env, make); new AssignAnalyzer(log, syms, lint, names).analyzeTree(env); new FlowAnalyzer().analyzeTree(env, make); new CaptureAnalyzer().analyzeTree(env, make); }
public void analyzeTree(Env<AttrContext> env, TreeMaker make) { new AliveAnalyzer().analyzeTree(env, make); new AssignAnalyzer().analyzeTree(env); new FlowAnalyzer().analyzeTree(env, make); new CaptureAnalyzer().analyzeTree(env, make); }