public BadClassFile badClassFile(String key, Object... args) { return new BadClassFile ( currentOwner.enclClass(), currentClassFile, diagFactory.fragment(key, args)); }
private JCDiagnostic createBadClassFileDiagnostic(JavaFileObject file, JCDiagnostic diag) { String key = (file.getKind() == JavaFileObject.Kind.SOURCE ? "bad.source.file.header" : "bad.class.file.header"); return diagFactory.fragment(key, file, diag); }
/** Check that type is a null or reference type. * @param pos Position to be used for error reporting. * @param t The type to be checked. */ Type checkNullOrRefType(DiagnosticPosition pos, Type t) { if (t.isReference() || t.hasTag(BOT)) return t; else return typeTagError(pos, diags.fragment("type.req.ref"), t); }
Type checkCastable(DiagnosticPosition pos, Type found, Type req, CheckContext checkContext) { if (types.isCastable(found, req, castWarner(pos, found, req))) { return req; } else { checkContext.report(pos, diags.fragment("inconvertible.types", found, req)); return types.createErrorType(found); } }
@Override public void report(DiagnosticPosition pos, JCDiagnostic details) { enclosingContext.report(pos, diags.fragment("incompatible.type.in.conditional", details)); } });
void reportEffectivelyFinalError(DiagnosticPosition pos, Symbol sym) { String subKey = currentTree.hasTag(LAMBDA) ? "lambda" : "inner.cls"; log.error(pos, "cant.ref.non.effectively.final.var", sym, diags.fragment(subKey)); }
public BadClassFile badClassFile(String key, Object... args) { return new BadClassFile ( currentOwner.enclClass(), currentClassFile, diagFactory.fragment(key, args)); }
/** Check that type is a null or reference type. * @param pos Position to be used for error reporting. * @param t The type to be checked. */ Type checkNullOrRefType(DiagnosticPosition pos, Type t) { if (t.isReference() || t.hasTag(BOT)) return t; else return typeTagError(pos, diags.fragment("type.req.ref"), t); }
private Object asTypeParam(Type t) { return (t.hasTag(TYPEVAR)) ? diags.fragment("type.parameter", t) : t; }
@Override public void report(DiagnosticPosition pos, JCDiagnostic details) { enclosingContext.report(pos, diags.fragment("incompatible.ret.type.in.lambda", details)); } }
@Override public void report(DiagnosticPosition pos, JCDiagnostic details) { chk.basicHandler.report(pos, diags.fragment("try.not.applicable.to.type", details)); } };
private JCDiagnostic createBadClassFileDiagnostic(JavaFileObject file, JCDiagnostic diag) { String key = (file.getKind() == JavaFileObject.Kind.SOURCE ? "bad.source.file.header" : "bad.class.file.header"); return diagFactory.fragment(key, file, diag); }
public Type getType(Type site) { site = removeWildcards(site); if (!chk.checkValidGenericType(site)) { //if the inferred functional interface type is not well-formed, //or if it's not a subtype of the original target, issue an error throw failure(diags.fragment("no.suitable.functional.intf.inst", site)); } return memberType(site, descSym); } }
JCDiagnostic getVerboseApplicableCandidateDiag(int pos, Symbol sym, Type inst) { JCDiagnostic subDiag = null; if (sym.type.hasTag(FORALL)) { subDiag = diags.fragment("partial.inst.sig", inst); } String key = subDiag == null ? "applicable.method.found" : "applicable.method.found.1"; return diags.fragment(key, pos, sym, subDiag); }
Type checkClassOrArrayType(DiagnosticPosition pos, Type t) { if (!t.hasTag(CLASS) && !t.hasTag(ARRAY) && !t.hasTag(ERROR)) { return typeTagError(pos, diags.fragment("type.req.class.array"), asTypeParam(t)); } else { return t; } }
private Object asTypeParam(Type t) { return (t.hasTag(TYPEVAR)) ? diags.fragment("type.parameter", t) : t; }
public Type getType(Type site) { site = removeWildcards(site); if (!chk.checkValidGenericType(site)) { //if the inferred functional interface type is not well-formed, //or if it's not a subtype of the original target, issue an error throw failure(diags.fragment("no.suitable.functional.intf.inst", site)); } return memberType(site, descSym); } }
Type checkClassOrArrayType(DiagnosticPosition pos, Type t) { if (!t.hasTag(CLASS) && !t.hasTag(ARRAY) && !t.hasTag(ERROR)) { return typeTagError(pos, diags.fragment("type.req.class.array"), asTypeParam(t)); } else { return t; } }
JCDiagnostic getVerboseApplicableCandidateDiag(int pos, Symbol sym, Type inst) { JCDiagnostic subDiag = null; if (sym.type.hasTag(FORALL)) { subDiag = diags.fragment("partial.inst.sig", inst); } String key = subDiag == null ? "applicable.method.found" : "applicable.method.found.1"; return diags.fragment(key, pos, sym, subDiag); }