[compat6] Make compat6 forward compatible with maven-pmd-plugin 3.22.0

This commit is contained in:
Andreas Dangel
2024-04-11 15:46:38 +02:00
parent 6ad8577880
commit 2905cec8ed
3 changed files with 25 additions and 4 deletions

View File

@ -346,6 +346,9 @@ public class PMDConfiguration extends AbstractConfiguration {
this.minimumPriority = minimumPriority; this.minimumPriority = minimumPriority;
} }
public void setMinimumPriority(net.sourceforge.pmd.lang.rule.RulePriority mininumPriority) {
this.minimumPriority = RulePriority.valueOf(mininumPriority.name());
}
/** /**
* Create a Renderer instance based upon the configured reporting options. * Create a Renderer instance based upon the configured reporting options.

View File

@ -49,10 +49,10 @@ import net.sourceforge.pmd.util.BaseResultProducingCloseable;
public class Report { public class Report {
// todo move to package reporting // todo move to package reporting
private final List<RuleViolation> violations = synchronizedList(new ArrayList<>()); protected final List<RuleViolation> violations = synchronizedList(new ArrayList<>());
private final List<SuppressedViolation> suppressedRuleViolations = synchronizedList(new ArrayList<>()); protected final List<SuppressedViolation> suppressedRuleViolations = synchronizedList(new ArrayList<>());
private final List<ProcessingError> errors = synchronizedList(new ArrayList<>()); protected final List<ProcessingError> errors = synchronizedList(new ArrayList<>());
private final List<ConfigurationError> configErrors = synchronizedList(new ArrayList<>()); protected final List<ConfigurationError> configErrors = synchronizedList(new ArrayList<>());
@DeprecatedUntil700 @DeprecatedUntil700
@InternalApi @InternalApi

View File

@ -4,6 +4,8 @@
package net.sourceforge.pmd.reporting; package net.sourceforge.pmd.reporting;
import java.util.function.Predicate;
import net.sourceforge.pmd.Rule; import net.sourceforge.pmd.Rule;
import net.sourceforge.pmd.lang.document.FileId; import net.sourceforge.pmd.lang.document.FileId;
@ -45,4 +47,20 @@ public class Report extends net.sourceforge.pmd.Report {
public static final class ReportBuilderListener extends net.sourceforge.pmd.Report.ReportBuilderListener { public static final class ReportBuilderListener extends net.sourceforge.pmd.Report.ReportBuilderListener {
} }
@Override
public Report filterViolations(Predicate<net.sourceforge.pmd.RuleViolation> filter) {
Report copy = new Report();
for (net.sourceforge.pmd.RuleViolation violation : violations) {
if (filter.test(violation)) {
copy.addRuleViolation(violation);
}
}
copy.suppressedRuleViolations.addAll(suppressedRuleViolations);
copy.errors.addAll(errors);
copy.configErrors.addAll(configErrors);
return copy;
}
} }