Merge pull request #4809 from adangel:issue-4348-internal-api
[core] Consolidate @InternalApi classes #4809
This commit is contained in:
206 files changed
+1395
-887
No files matched your search
@@ -38,7 +38,7 @@ import net.sourceforge.pmd.renderers.Renderer;
|
||||
import net.sourceforge.pmd.renderers.RendererFactory;
|
||||
import net.sourceforge.pmd.reporting.ReportStats;
|
||||
import net.sourceforge.pmd.util.StringUtil;
|
||||
import net.sourceforge.pmd.util.log.MessageReporter;
|
||||
import net.sourceforge.pmd.util.log.PmdReporter;
|
||||
import net.sourceforge.pmd.util.log.internal.SimpleMessageReporter;
|
||||
|
||||
import picocli.CommandLine.Command;
|
||||
@@ -302,7 +302,7 @@ public class PmdCommand extends AbstractAnalysisPmdSubcommand<PMDConfiguration>
|
||||
TimeTracker.startGlobalTracking();
|
||||
}
|
||||
|
||||
final MessageReporter pmdReporter = configuration.getReporter();
|
||||
final PmdReporter pmdReporter = configuration.getReporter();
|
||||
|
||||
try {
|
||||
PmdAnalysis pmd = null;
|
||||
@@ -350,14 +350,14 @@ public class PmdCommand extends AbstractAnalysisPmdSubcommand<PMDConfiguration>
|
||||
}
|
||||
}
|
||||
|
||||
private void printErrorDetected(MessageReporter reporter, int errors) {
|
||||
private void printErrorDetected(PmdReporter reporter, int errors) {
|
||||
String msg = LogMessages.errorDetectedMessage(errors, "pmd");
|
||||
// note: using error level here increments the error count of the reporter,
|
||||
// which we don't want.
|
||||
reporter.info(StringUtil.quoteMessageFormat(msg));
|
||||
}
|
||||
|
||||
private void finishBenchmarker(final MessageReporter pmdReporter) {
|
||||
private void finishBenchmarker(final PmdReporter pmdReporter) {
|
||||
if (benchmark) {
|
||||
final TimingReport timingReport = TimeTracker.stopGlobalTracking();
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.slf4j.event.Level;
|
||||
|
||||
import net.sourceforge.pmd.AbstractConfiguration;
|
||||
import net.sourceforge.pmd.internal.Slf4jSimpleConfiguration;
|
||||
import net.sourceforge.pmd.util.log.MessageReporter;
|
||||
import net.sourceforge.pmd.util.log.PmdReporter;
|
||||
import net.sourceforge.pmd.util.log.internal.SimpleMessageReporter;
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@ public final class PmdRootLogger {
|
||||
resetLogLevel = true;
|
||||
}
|
||||
|
||||
MessageReporter pmdReporter = setupMessageReporter();
|
||||
PmdReporter pmdReporter = setupMessageReporter();
|
||||
conf.setReporter(pmdReporter);
|
||||
return runnable.apply(conf);
|
||||
} finally {
|
||||
@@ -58,14 +58,14 @@ public final class PmdRootLogger {
|
||||
}
|
||||
}
|
||||
|
||||
private static @NonNull MessageReporter setupMessageReporter() {
|
||||
private static @NonNull PmdReporter setupMessageReporter() {
|
||||
// Note: This implementation uses slf4j as the backend. If PMD is integrated into an application
|
||||
// a slf4j implementation binding must be provided to see any loggings (even errors).
|
||||
// In pmd-cli, we use slf4j-simple.
|
||||
|
||||
// create a top-level reporter
|
||||
// TODO CLI errors should also be reported through this
|
||||
MessageReporter pmdReporter = new SimpleMessageReporter(log);
|
||||
PmdReporter pmdReporter = new SimpleMessageReporter(log);
|
||||
// always install java.util.logging to slf4j bridge
|
||||
Slf4jSimpleConfiguration.installJulBridge();
|
||||
// logging, mostly for testing purposes
|
||||
|
||||
Reference in new issue
Block a user