--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java Tue Mar 26 12:12:49 2019 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java Fri Mar 29 07:38:34 2019 -0700
@@ -805,9 +805,8 @@
*/
public void readSourceFile(JCCompilationUnit tree, ClassSymbol c) throws CompletionFailure {
if (completionFailureName == c.fullname) {
- JCDiagnostic msg =
- diagFactory.fragment(Fragments.UserSelectedCompletionFailure);
- throw new CompletionFailure(c, msg, dcfh);
+ throw new CompletionFailure(
+ c, () -> diagFactory.fragment(Fragments.UserSelectedCompletionFailure), dcfh);
}
JavaFileObject filename = c.classfile;
JavaFileObject prev = log.useSource(filename);
@@ -835,7 +834,7 @@
// have enough modules available to access java.lang, and
// so risk getting FatalError("no.java.lang") from MemberEnter.
if (!modules.enter(List.of(tree), c)) {
- throw new CompletionFailure(c, diags.fragment(Fragments.CantResolveModules), dcfh);
+ throw new CompletionFailure(c, () -> diags.fragment(Fragments.CantResolveModules), dcfh);
}
enter.complete(List.of(tree), c);