langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java
changeset 24610 8b3b718970a9
parent 24218 9102c46a15dc
child 25443 9187d77f2c64
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Tue May 27 18:57:44 2014 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Tue May 27 22:26:53 2014 +0100
@@ -231,7 +231,8 @@
         }
     }
 
-    public List<Type> analyzeLambdaThrownTypes(Env<AttrContext> env, JCLambda that, TreeMaker make) {
+    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
@@ -239,7 +240,13 @@
         //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, enforceThisDotInit).analyzeTree(env);
+            new AssignAnalyzer(log, syms, lint, names, enforceThisDotInit) {
+                @Override
+                protected boolean trackable(VarSymbol sym) {
+                    return !env.info.scope.includes(sym) &&
+                           sym.owner.kind == MTH;
+                }
+            }.analyzeTree(env);
             LambdaFlowAnalyzer flowAnalyzer = new LambdaFlowAnalyzer();
             flowAnalyzer.analyzeTree(env, that, make);
             return flowAnalyzer.inferredThrownTypes;