langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java
changeset 14538 384681be798f
parent 14359 d4099818ab70
child 14547 86d8d242b0c4
equal deleted inserted replaced
14537:ad188879b6fe 14538:384681be798f
   211         new FlowAnalyzer().analyzeTree(env, make);
   211         new FlowAnalyzer().analyzeTree(env, make);
   212         new CaptureAnalyzer().analyzeTree(env, make);
   212         new CaptureAnalyzer().analyzeTree(env, make);
   213     }
   213     }
   214 
   214 
   215     public void analyzeLambda(Env<AttrContext> env, JCLambda that, TreeMaker make, boolean speculative) {
   215     public void analyzeLambda(Env<AttrContext> env, JCLambda that, TreeMaker make, boolean speculative) {
   216         java.util.Queue<JCDiagnostic> prevDeferredDiagnostics = log.deferredDiagnostics;
   216         Log.DiagnosticHandler diagHandler = null;
   217         Filter<JCDiagnostic> prevDeferDiagsFilter = log.deferredDiagFilter;
       
   218         //we need to disable diagnostics temporarily; the problem is that if
   217         //we need to disable diagnostics temporarily; the problem is that if
   219         //a lambda expression contains e.g. an unreachable statement, an error
   218         //a lambda expression contains e.g. an unreachable statement, an error
   220         //message will be reported and will cause compilation to skip the flow analyis
   219         //message will be reported and will cause compilation to skip the flow analyis
   221         //step - if we suppress diagnostics, we won't stop at Attr for flow-analysis
   220         //step - if we suppress diagnostics, we won't stop at Attr for flow-analysis
   222         //related errors, which will allow for more errors to be detected
   221         //related errors, which will allow for more errors to be detected
   223         if (!speculative) {
   222         if (!speculative) {
   224             log.deferAll();
   223             diagHandler = new Log.DiscardDiagnosticHandler(log);
   225             log.deferredDiagnostics = ListBuffer.lb();
       
   226         }
   224         }
   227         try {
   225         try {
   228             new AliveAnalyzer().analyzeTree(env, that, make);
   226             new AliveAnalyzer().analyzeTree(env, that, make);
   229             new FlowAnalyzer().analyzeTree(env, that, make);
   227             new FlowAnalyzer().analyzeTree(env, that, make);
   230         } finally {
   228         } finally {
   231             if (!speculative) {
   229             if (!speculative) {
   232                 log.deferredDiagFilter = prevDeferDiagsFilter;
   230                 log.popDiagnosticHandler(diagHandler);
   233                 log.deferredDiagnostics = prevDeferredDiagnostics;
       
   234             }
   231             }
   235         }
   232         }
   236     }
   233     }
   237 
   234 
   238     /**
   235     /**