< prev index next >

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

Print this page
rev 48841 : [mq]: 8187950

*** 61,70 **** --- 61,72 ---- import static javax.tools.StandardLocation.*; import static com.sun.tools.javac.code.Flags.*; import static com.sun.tools.javac.code.Kinds.Kind.*; + import com.sun.tools.javac.code.Symbol; + import com.sun.tools.javac.code.Symbol.CompletionFailure; import com.sun.tools.javac.main.DelegatingJavaFileManager; import com.sun.tools.javac.util.Dependencies.CompletionCause; /**
*** 129,138 **** --- 131,142 ---- /** Factory for diagnostics */ JCDiagnostic.Factory diagFactory; + final DeferredCompletionFailureHandler dcfh; + /** Can be reassigned from outside: * the completer to be used for ".java" files. If this remains unassigned * ".java" files will not be loaded. */ public Completer sourceCompleter = Completer.NULL_COMPLETER;
*** 183,192 **** --- 187,197 ---- fileManager = context.get(JavaFileManager.class); dependencies = Dependencies.instance(context); if (fileManager == null) throw new AssertionError("FileManager initialization error"); diagFactory = JCDiagnostic.Factory.instance(context); + dcfh = DeferredCompletionFailureHandler.instance(context); log = Log.instance(context); annotate = Annotate.instance(context); Options options = Options.instance(context);
*** 215,224 **** --- 220,231 ---- useCtProps = false; } jrtIndex = useCtProps && JRTIndex.isAvailable() ? JRTIndex.getSharedInstance() : null; profile = Profile.instance(context); + cachedCompletionFailure = new CompletionFailure(null, (JCDiagnostic) null, dcfh); + cachedCompletionFailure.setStackTrace(new StackTraceElement[0]); } /************************************************************************ * Temporary ct.sym replacement
*** 291,301 **** try { fillIn(p); } catch (IOException ex) { JCDiagnostic msg = diagFactory.fragment(Fragments.ExceptionMessage(ex.getLocalizedMessage())); ! throw new CompletionFailure(sym, msg).initCause(ex); } } if (!reader.filling) annotate.flush(); // finish attaching annotations } --- 298,308 ---- try { fillIn(p); } catch (IOException ex) { JCDiagnostic msg = diagFactory.fragment(Fragments.ExceptionMessage(ex.getLocalizedMessage())); ! throw new CompletionFailure(sym, msg, dcfh).initCause(ex); } } if (!reader.filling) annotate.flush(); // finish attaching annotations }
*** 330,340 **** */ void fillIn(ClassSymbol c) { if (completionFailureName == c.fullname) { JCDiagnostic msg = diagFactory.fragment(Fragments.UserSelectedCompletionFailure); ! throw new CompletionFailure(c, msg); } currentOwner = c; JavaFileObject classfile = c.classfile; if (classfile != null) { JavaFileObject previousClassFile = currentClassFile; --- 337,347 ---- */ void fillIn(ClassSymbol c) { if (completionFailureName == c.fullname) { JCDiagnostic msg = diagFactory.fragment(Fragments.UserSelectedCompletionFailure); ! throw new CompletionFailure(c, msg, dcfh); } currentOwner = c; JavaFileObject classfile = c.classfile; if (classfile != null) { JavaFileObject previousClassFile = currentClassFile;
*** 395,417 **** JCDiagnostic diag) { if (!cacheCompletionFailure) { // log.warning("proc.messager", // Log.getLocalizedString("class.file.not.found", c.flatname)); // c.debug.printStackTrace(); ! return new CompletionFailure(c, diag); } else { CompletionFailure result = cachedCompletionFailure; result.sym = c; result.diag = diag; return result; } } ! private final CompletionFailure cachedCompletionFailure = ! new CompletionFailure(null, (JCDiagnostic) null); ! { ! cachedCompletionFailure.setStackTrace(new StackTraceElement[0]); ! } /** Load a toplevel class with given fully qualified name * The class is entered into `classes' only if load was successful. */ --- 402,420 ---- JCDiagnostic diag) { if (!cacheCompletionFailure) { // log.warning("proc.messager", // Log.getLocalizedString("class.file.not.found", c.flatname)); // c.debug.printStackTrace(); ! return new CompletionFailure(c, diag, dcfh); } else { CompletionFailure result = cachedCompletionFailure; result.sym = c; result.diag = diag; return result; } } ! private final CompletionFailure cachedCompletionFailure; /** Load a toplevel class with given fully qualified name * The class is entered into `classes' only if load was successful. */
*** 773,784 **** */ public static class BadClassFile extends CompletionFailure { private static final long serialVersionUID = 0; public BadClassFile(TypeSymbol sym, JavaFileObject file, JCDiagnostic diag, ! JCDiagnostic.Factory diagFactory) { ! super(sym, createBadClassFileDiagnostic(file, diag, diagFactory)); } // where private static JCDiagnostic createBadClassFileDiagnostic( JavaFileObject file, JCDiagnostic diag, JCDiagnostic.Factory diagFactory) { String key = (file.getKind() == JavaFileObject.Kind.SOURCE --- 776,787 ---- */ public static class BadClassFile extends CompletionFailure { private static final long serialVersionUID = 0; public BadClassFile(TypeSymbol sym, JavaFileObject file, JCDiagnostic diag, ! JCDiagnostic.Factory diagFactory, DeferredCompletionFailureHandler dcfh) { ! super(sym, createBadClassFileDiagnostic(file, diag, diagFactory), dcfh); } // where private static JCDiagnostic createBadClassFileDiagnostic( JavaFileObject file, JCDiagnostic diag, JCDiagnostic.Factory diagFactory) { String key = (file.getKind() == JavaFileObject.Kind.SOURCE
*** 789,798 **** public static class BadEnclosingMethodAttr extends BadClassFile { private static final long serialVersionUID = 0; public BadEnclosingMethodAttr(TypeSymbol sym, JavaFileObject file, JCDiagnostic diag, ! JCDiagnostic.Factory diagFactory) { ! super(sym, file, diag, diagFactory); } } } --- 792,801 ---- public static class BadEnclosingMethodAttr extends BadClassFile { private static final long serialVersionUID = 0; public BadEnclosingMethodAttr(TypeSymbol sym, JavaFileObject file, JCDiagnostic diag, ! JCDiagnostic.Factory diagFactory, DeferredCompletionFailureHandler dcfh) { ! super(sym, file, diag, diagFactory, dcfh); } } }
< prev index next >