break; log.report(factory.create(type, log.currentSource(), pos, MESSAGE_BUNDLE_KEY, message)); } finally { if (originalSource != null) {
public void logFatalError(Log log, Context context) { String version = ErrorProneVersion.loadVersionFromPom().or("unknown version"); JavaFileObject originalSource = log.useSource(source); Factory factory = Factory.instance(context); try { log.report( factory.create( DiagnosticType.ERROR, log.currentSource(), pos, "error.prone.crash", Throwables.getStackTraceAsString(cause), version, checkName)); } finally { log.useSource(originalSource); } }
/** * Create a fragment diagnostic, for use as an argument in other diagnostics * @param key The key for the localized message. * @param args Fields of the message. */ public JCDiagnostic fragment(String key, Object... args) { return create(FRAGMENT, null, EnumSet.noneOf(DiagnosticFlag.class), null, null, key, args); }
/** * Create a warning diagnostic. * @param lc The lint category for the diagnostic * @param source The source of the compilation unit, if any, in which to report the warning. * @param pos The source position at which to report the warning. * @param key The key for the localized warning message. * @param args Fields of the warning message. * @see MandatoryWarningHandler */ public JCDiagnostic warning( LintCategory lc, DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) { return create(WARNING, lc, EnumSet.noneOf(DiagnosticFlag.class), source, pos, key, args); }
/** * Create a fragment diagnostic, for use as an argument in other diagnostics * @param key The key for the localized message. * @param args Fields of the message. */ public JCDiagnostic fragment(String key, Object... args) { return create(FRAGMENT, null, EnumSet.noneOf(DiagnosticFlag.class), null, null, key, args); }
/** * Create a warning diagnostic. * @param lc The lint category for the diagnostic * @param key The key for the localized error message. * @param args Fields of the warning message. * @see MandatoryWarningHandler */ public JCDiagnostic warning( LintCategory lc, String key, Object... args) { return create(WARNING, lc, EnumSet.noneOf(DiagnosticFlag.class), null, null, key, args); }
@Override JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { return diags.create(dkind, log.currentSource(), pos, "cant.access.inner.cls.constr", site.tsym.name, argtypes, site.getEnclosingType()); } };
/** * Create a note diagnostic. * @param key The key for the localized error message. * @param args Fields of the message. */ public JCDiagnostic note(String key, Object... args) { return create(NOTE, null, EnumSet.noneOf(DiagnosticFlag.class), null, null, key, args); }
/** * Create an error diagnostic. * @param source The source of the compilation unit, if any, in which to report the error. * @param pos The source position at which to report the error. * @param key The key for the localized error message. * @param args Fields of the error message. */ public JCDiagnostic error( DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) { return create(ERROR, null, defaultErrorFlags, source, pos, key, args); }
/** * Create an error diagnostic. * @param source The source of the compilation unit, if any, in which to report the error. * @param pos The source position at which to report the error. * @param key The key for the localized error message. * @param args Fields of the error message. */ public JCDiagnostic error( DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) { return create(ERROR, null, defaultErrorFlags, source, pos, key, args); }
/** * Create a note diagnostic. * @param source The source of the compilation unit, if any, in which to report the note. * @param pos The source position at which to report the note. * @param key The key for the localized message. * @param args Fields of the message. */ public JCDiagnostic note( DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) { return create(NOTE, null, EnumSet.noneOf(DiagnosticFlag.class), source, pos, key, args); }
/** * Create a note diagnostic that will not be hidden by the -nowarn or -Xlint:none options. * @param key The key for the localized message. * @param args Fields of the message. * @see MandatoryWarningHandler */ public JCDiagnostic mandatoryNote(DiagnosticSource source, String key, Object... args) { return create(NOTE, null, EnumSet.of(DiagnosticFlag.MANDATORY), source, null, key, args); }
/** * Create a warning diagnostic. * @param source The source of the compilation unit, if any, in which to report the warning. * @param pos The source position at which to report the warning. * @param key The key for the localized warning message. * @param args Fields of the warning message. */ public JCDiagnostic warning( DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) { return create(WARNING, null, EnumSet.noneOf(DiagnosticFlag.class), source, pos, key, args); }
/** * Create a warning diagnostic that will not be hidden by the -nowarn or -Xlint:none options. * @param source The source of the compilation unit, if any, in which to report the warning. * @param pos The source position at which to report the warning. * @param key The key for the localized warning message. * @param args Fields of the warning message. * @see MandatoryWarningHandler */ public JCDiagnostic mandatoryWarning( DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) { return create(WARNING, null, EnumSet.of(DiagnosticFlag.MANDATORY), source, pos, key, args); }
/** * Create a note diagnostic. * @param key The key for the localized error message. * @param args Fields of the message. */ public JCDiagnostic note(String key, Object... args) { return create(NOTE, null, EnumSet.noneOf(DiagnosticFlag.class), null, null, key, args); }
/** * Create a note diagnostic. * @param source The source of the compilation unit, if any, in which to report the note. * @param pos The source position at which to report the note. * @param key The key for the localized message. * @param args Fields of the message. */ public JCDiagnostic note( DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) { return create(NOTE, null, EnumSet.noneOf(DiagnosticFlag.class), source, pos, key, args); }
/** * Create a warning diagnostic that will not be hidden by the -nowarn or -Xlint:none options. * @param source The source of the compilation unit, if any, in which to report the warning. * @param pos The source position at which to report the warning. * @param key The key for the localized warning message. * @param args Fields of the warning message. * @see MandatoryWarningHandler */ public JCDiagnostic mandatoryWarning( DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) { return create(WARNING, null, EnumSet.of(DiagnosticFlag.MANDATORY), source, pos, key, args); }
@Override public JCDiagnostic rewriteDiagnostic(JCDiagnostic.Factory diags, DiagnosticPosition preferedPos, DiagnosticSource preferredSource, DiagnosticType preferredKind, JCDiagnostic d) { JCDiagnostic cause = (JCDiagnostic)d.getArgs()[0]; return diags.create(preferredKind, preferredSource, d.getDiagnosticPosition(), "prob.found.req", cause); } });
/** * Create a warning diagnostic. * @param lc The lint category for the diagnostic * @param key The key for the localized error message. * @param args Fields of the warning message. * @see MandatoryWarningHandler */ public JCDiagnostic warning( LintCategory lc, String key, Object... args) { return create(WARNING, lc, EnumSet.noneOf(DiagnosticFlag.class), null, null, key, args); }
@Override JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { return diags.create(dkind, log.currentSource(), pos, "cant.access.inner.cls.constr", site.tsym.name, argtypes, site.getEnclosingType()); } };