private static boolean maybeFunctionalInterface(Type type, Types types, VisitorState state) { try { return types.isFunctionalInterface(type); } catch (CompletionFailure e) { // Report completion errors to avoid e.g. https://github.com/bazelbuild/bazel/issues/4105 Check.instance(state.context) .completionError((DiagnosticPosition) state.getPath().getLeaf(), e); return false; } } }
/** * Return true if this parameter is assignable to the target parameter. This will consider * subclassing, autoboxing and null. */ boolean isAssignableTo(Parameter target, VisitorState state) { if (state.getTypes().isSameType(type(), Type.noType) || state.getTypes().isSameType(target.type(), Type.noType)) { return false; } try { return state.getTypes().isAssignable(type(), target.type()); } catch (CompletionFailure e) { // Report completion errors to avoid e.g. https://github.com/bazelbuild/bazel/issues/4105 Check.instance(state.context) .completionError((DiagnosticPosition) state.getPath().getLeaf(), e); return false; } }
/** Same, but handling completion failures. */ boolean isUnchecked(DiagnosticPosition pos, Type exc) { try { return isUnchecked(exc); } catch (CompletionFailure ex) { completionError(pos, ex); return true; } }
/** Same, but handling completion failures. */ boolean isUnchecked(DiagnosticPosition pos, Type exc) { try { return isUnchecked(exc); } catch (CompletionFailure ex) { completionError(pos, ex); return true; } }
/** Same, but handling completion failures. */ boolean isUnchecked(DiagnosticPosition pos, Type exc) { try { return isUnchecked(exc); } catch (CompletionFailure ex) { completionError(pos, ex); return true; } }
/** Same, but handling completion failures. */ boolean isUnchecked(DiagnosticPosition pos, Type exc) { try { return isUnchecked(exc); } catch (CompletionFailure ex) { completionError(pos, ex); return true; } }
/** Visitor method: Validate a type expression, if it is not null, catching * and reporting any completion failures. */ void validate(JCTree tree) { try { if (tree != null) tree.accept(validator); } catch (CompletionFailure ex) { completionError(tree.pos(), ex); } }
/** Visitor method: Validate a type expression, if it is not null, catching * and reporting any completion failures. */ void validate(JCTree tree) { try { if (tree != null) tree.accept(validator); } catch (CompletionFailure ex) { completionError(tree.pos(), ex); } }
/** Enter field and method definitions and process import * clauses, catching any completion failure exceptions. */ protected void memberEnter(JCTree tree, Env<AttrContext> env) { Env<AttrContext> prevEnv = this.env; try { this.env = env; tree.accept(this); } catch (CompletionFailure ex) { chk.completionError(tree.pos(), ex); } finally { this.env = prevEnv; } }
/** * Attribute a top level tree. These trees are encountered when the * package declaration has annotations. */ public void attribTopLevel(Env<AttrContext> env) { JCCompilationUnit toplevel = env.toplevel; try { annotate.flush(); } catch (CompletionFailure ex) { chk.completionError(toplevel.pos(), ex); } }
/** * Attribute a top level tree. These trees are encountered when the * package declaration has annotations. */ public void attribTopLevel(Env<AttrContext> env) { JCCompilationUnit toplevel = env.toplevel; try { annotate.flush(); } catch (CompletionFailure ex) { chk.completionError(toplevel.pos(), ex); } }
/** Main method: attribute class definition associated with given class symbol. * reporting completion failures at the given position. * @param pos The source position at which completion errors are to be * reported. * @param c The class symbol whose definition will be attributed. */ public void attribClass(DiagnosticPosition pos, ClassSymbol c) { try { annotate.flush(); attribClass(c); } catch (CompletionFailure ex) { chk.completionError(pos, ex); } }
/** Visitor method: generate code for a definition, catching and reporting * any completion failures. * @param tree The definition to be visited. * @param env The environment current at the definition. */ public void genDef(JCTree tree, Env<GenContext> env) { Env<GenContext> prevEnv = this.env; try { this.env = env; tree.accept(this); } catch (CompletionFailure ex) { chk.completionError(tree.pos(), ex); } finally { this.env = prevEnv; } }
/** Main method: attribute class definition associated with given class symbol. * reporting completion failures at the given position. * @param pos The source position at which completion errors are to be * reported. * @param c The class symbol whose definition will be attributed. */ public void attribClass(DiagnosticPosition pos, ClassSymbol c) { try { annotate.flush(); attribClass(c); } catch (CompletionFailure ex) { chk.completionError(pos, ex); } }
/** Main method: attribute class definition associated with given class symbol. * reporting completion failures at the given position. * @param pos The source position at which completion errors are to be * reported. * @param c The class symbol whose definition will be attributed. */ public void attribClass(DiagnosticPosition pos, ClassSymbol c) { try { annotate.flush(); attribClass(c); } catch (CompletionFailure ex) { chk.completionError(pos, ex); } }
/** Enter field and method definitions and process import * clauses, catching any completion failure exceptions. */ protected void memberEnter(JCTree tree, Env<AttrContext> env) { Env<AttrContext> prevEnv = this.env; try { this.env = env; tree.accept(this); } catch (CompletionFailure ex) { chk.completionError(tree.pos(), ex); } finally { this.env = prevEnv; } }
/** Enter field and method definitions and process import * clauses, catching any completion failure exceptions. */ protected void memberEnter(JCTree tree, Env<AttrContext> env) { Env<AttrContext> prevEnv = this.env; try { this.env = env; tree.accept(this); } catch (CompletionFailure ex) { chk.completionError(tree.pos(), ex); } finally { this.env = prevEnv; } }
/** * Load ClassDoc by qualified name. */ public ClassDocImpl loadClass(String name) { try { ClassSymbol c = reader.loadClass(names.fromString(name)); return getClassDoc(c); } catch (CompletionFailure ex) { chk.completionError(null, ex); return null; } }
/** Return first abstract member of class `sym'. */ public MethodSymbol firstUnimplementedAbstract(ClassSymbol sym) { try { return firstUnimplementedAbstractImpl(sym, sym); } catch (CompletionFailure ex) { chk.completionError(enter.getEnv(sym).tree.pos(), ex); return null; } } //where:
private static boolean maybeFunctionalInterface(Type type, Types types, VisitorState state) { try { return types.isFunctionalInterface(type); } catch (CompletionFailure e) { // Report completion errors to avoid e.g. https://github.com/bazelbuild/bazel/issues/4105 Check.instance(state.context) .completionError((DiagnosticPosition) state.getPath().getLeaf(), e); return false; } }