229 log.popDiagnosticHandler(diagHandler); |
229 log.popDiagnosticHandler(diagHandler); |
230 } |
230 } |
231 } |
231 } |
232 } |
232 } |
233 |
233 |
234 public List<Type> analyzeLambdaThrownTypes(Env<AttrContext> env, JCLambda that, TreeMaker make) { |
234 public List<Type> analyzeLambdaThrownTypes(final Env<AttrContext> env, |
|
235 JCLambda that, TreeMaker make) { |
235 //we need to disable diagnostics temporarily; the problem is that if |
236 //we need to disable diagnostics temporarily; the problem is that if |
236 //a lambda expression contains e.g. an unreachable statement, an error |
237 //a lambda expression contains e.g. an unreachable statement, an error |
237 //message will be reported and will cause compilation to skip the flow analyis |
238 //message will be reported and will cause compilation to skip the flow analyis |
238 //step - if we suppress diagnostics, we won't stop at Attr for flow-analysis |
239 //step - if we suppress diagnostics, we won't stop at Attr for flow-analysis |
239 //related errors, which will allow for more errors to be detected |
240 //related errors, which will allow for more errors to be detected |
240 Log.DiagnosticHandler diagHandler = new Log.DiscardDiagnosticHandler(log); |
241 Log.DiagnosticHandler diagHandler = new Log.DiscardDiagnosticHandler(log); |
241 try { |
242 try { |
242 new AssignAnalyzer(log, syms, lint, names, enforceThisDotInit).analyzeTree(env); |
243 new AssignAnalyzer(log, syms, lint, names, enforceThisDotInit) { |
|
244 @Override |
|
245 protected boolean trackable(VarSymbol sym) { |
|
246 return !env.info.scope.includes(sym) && |
|
247 sym.owner.kind == MTH; |
|
248 } |
|
249 }.analyzeTree(env); |
243 LambdaFlowAnalyzer flowAnalyzer = new LambdaFlowAnalyzer(); |
250 LambdaFlowAnalyzer flowAnalyzer = new LambdaFlowAnalyzer(); |
244 flowAnalyzer.analyzeTree(env, that, make); |
251 flowAnalyzer.analyzeTree(env, that, make); |
245 return flowAnalyzer.inferredThrownTypes; |
252 return flowAnalyzer.inferredThrownTypes; |
246 } finally { |
253 } finally { |
247 log.popDiagnosticHandler(diagHandler); |
254 log.popDiagnosticHandler(diagHandler); |