< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/code/DeferredCompletionFailureHandler.java

Print this page
rev 54093 : 8177068: incomplete classpath causes NPE in Flow
Summary: Undo completions that failed during speculative attribution, so that the appropriate CompletionFailures are thrown again and properly reported.
Reviewed-by: vromero

@@ -84,10 +84,30 @@
         public void uninstall() {
             class2Flip.values().forEach(f -> f.flip());
         }
     };
 
+    public final Handler speculativeCodeHandler = new Handler() {
+        private final Map<ClassSymbol, FlipSymbolDescription> class2Flip = new HashMap<>();
+
+        public void install() {
+        }
+        public void handleAPICompletionFailure(CompletionFailure cf) {
+            throw cf;
+        }
+        public void classSymbolCompleteFailed(ClassSymbol sym, Completer origCompleter) {
+            class2Flip.put(sym, new FlipSymbolDescription(sym, new DeferredCompleter(origCompleter)));
+        }
+        public void classSymbolRemoved(ClassSymbol sym) {
+            class2Flip.remove(sym);
+        }
+        public void uninstall() {
+            class2Flip.values().forEach(f -> f.flip());
+            class2Flip.clear();
+        }
+    };
+
     public final Handler javacCodeHandler = new Handler() {
         public void install() {
         }
         public void handleAPICompletionFailure(CompletionFailure cf) {
             throw cf;
< prev index next >