diff -r 9b2de82e7e49 src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java Wed Feb 15 16:18:18 2017 -0800 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java Thu Mar 23 11:59:41 2017 -0700 @@ -122,6 +122,9 @@ */ public Completer completer; + /** The cached completion failure for this symbol. */ + public CompletionFailure cf; + /** A cache for the type erasure of this symbol. */ public Type erasure_field; @@ -627,10 +630,18 @@ /** Complete the elaboration of this symbol's definition. */ public void complete() throws CompletionFailure { - if (completer != Completer.NULL_COMPLETER) { - Completer c = completer; - completer = Completer.NULL_COMPLETER; - c.complete(this); + if (this.cf != null) { + throw this.cf; + } + try { + if (completer != Completer.NULL_COMPLETER) { + Completer c = completer; + completer = Completer.NULL_COMPLETER; + c.complete(this); + } + } catch (CompletionFailure cf) { + this.cf = cf; + throw cf; } } diff -r 9b2de82e7e49 src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java Wed Feb 15 16:18:18 2017 -0800 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java Thu Mar 23 11:59:41 2017 -0700 @@ -377,6 +377,7 @@ c.flatname = names.fromString(tree.packge + "." + name); c.sourcefile = tree.sourcefile; c.completer = Completer.NULL_COMPLETER; + c.cf = null; c.members_field = WriteableScope.create(c); tree.packge.package_info = c; } @@ -461,6 +462,7 @@ // Fill out class fields. c.completer = Completer.NULL_COMPLETER; // do not allow the initial completer linger on. + c.cf = null; c.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, c, tree); c.sourcefile = env.toplevel.sourcefile; c.members_field = WriteableScope.create(c); diff -r 9b2de82e7e49 src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Wed Feb 15 16:18:18 2017 -0800 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Thu Mar 23 11:59:41 2017 -0700 @@ -1166,11 +1166,13 @@ if (cs.classfile == null) cs.classfile = file; cs.completer = initialCompleter; + cs.cf = null; } else { cs = symtab.enterClass(moduleAndClassFiles.getKey(), name); cs.reset(); cs.classfile = file; cs.completer = initialCompleter; + cs.cf = null; cs.owner.members().enter(cs); //XXX - OverwriteBetweenCompilations; syms.getClass is not sufficient anymore } list = list.prepend(cs);