diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 863468972a..32e7032ecc 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -29,12 +29,21 @@ This is a {{ site.pmd.release_type }} release. #### Deprecated API Some API deprecations were performed in core PMD classes, to improve compatibility with PMD 7. -- {% jdoc core::Report %}: construction methods like addViolation or createReport +- {% jdoc core::Report %}: the constructor and other construction methods like addViolation or createReport - {% jdoc core::RuleContext %}: all constructors, getters and setters. A new set of stable methods, matching those in PMD 7, was added to replace the `addViolation` overloads of {% jdoc core::lang.rule.AbstractRule %}. In PMD 7, `RuleContext` will be the API to report violations, and it can already be used as such in PMD 6. +- The field {% jdoc core::PMD#configuration %} is unused and will be removed. + +#### Internal API + +Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. +You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. + - {% jdoc core::RuleSet %}: methods that serve to apply rules, including `apply`, `start`, `end`, `removeDysfunctionalRules` +- {% jdoc !!core::renderers.AbstractAccumulatingRenderer#renderFileReport(Report) %} is internal API + and should not be overridden in own renderers. #### Changed API diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java b/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java index 43ec00cd91..7d28d2dcd3 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java @@ -59,6 +59,17 @@ import net.sourceforge.pmd.util.log.ScopedLogHandlersManager; * process is controlled via interactions with this class. A command line * interface is supported, as well as a programmatic API for integrating PMD * with other software such as IDEs and Ant. + * + *

Main entrypoints are: + *

+ * + *

Warning: This class is not intended to be instantiated or subclassed. It will + * be made final in PMD7. */ public final class PMD { diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/renderers/AbstractAccumulatingRenderer.java b/pmd-core/src/main/java/net/sourceforge/pmd/renderers/AbstractAccumulatingRenderer.java index 167acf83c2..2e5b7fe7bf 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/renderers/AbstractAccumulatingRenderer.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/renderers/AbstractAccumulatingRenderer.java @@ -10,6 +10,7 @@ import java.util.Objects; import net.sourceforge.pmd.Report; import net.sourceforge.pmd.Report.ConfigurationError; import net.sourceforge.pmd.Report.GlobalReportBuilderListener; +import net.sourceforge.pmd.annotation.InternalApi; import net.sourceforge.pmd.benchmark.TimeTracker; import net.sourceforge.pmd.benchmark.TimedOperation; import net.sourceforge.pmd.benchmark.TimedOperationCategory; @@ -24,6 +25,9 @@ import net.sourceforge.pmd.util.datasource.DataSource; * quite large in some scenarios. Consider using * {@link AbstractIncrementingRenderer} which can use significantly less memory. * + *

Subclasses should only implement the {@link #end()} method to output the + * complete {@link #report}. + * * @see AbstractIncrementingRenderer */ public abstract class AbstractAccumulatingRenderer extends AbstractRenderer { @@ -48,7 +52,15 @@ public abstract class AbstractAccumulatingRenderer extends AbstractRenderer { Objects.requireNonNull(dataSource); } + /** + * {@inheritDoc} + * + * @deprecated This is internal API. Do not override when extending {@link AbstractAccumulatingRenderer}. + * In PMD7 this method will be made final. + */ @Override + @InternalApi + @Deprecated public final void renderFileReport(Report report) throws IOException { // do nothing, final because it will never be called by the listener Objects.requireNonNull(report); diff --git a/pmd-test/src/main/java/net/sourceforge/pmd/testframework/RuleTst.java b/pmd-test/src/main/java/net/sourceforge/pmd/testframework/RuleTst.java index 0480e60040..e3a35697ac 100644 --- a/pmd-test/src/main/java/net/sourceforge/pmd/testframework/RuleTst.java +++ b/pmd-test/src/main/java/net/sourceforge/pmd/testframework/RuleTst.java @@ -256,20 +256,20 @@ public abstract class RuleTst { public Report runTestFromString(String code, Rule rule, LanguageVersion languageVersion, boolean isUseAuxClasspath) { try { - PMDConfiguration config = new PMDConfiguration(); - config.setIgnoreIncrementalAnalysis(true); - config.setDefaultLanguageVersion(languageVersion); - config.setThreads(1); + PMDConfiguration configuration = new PMDConfiguration(); + configuration.setIgnoreIncrementalAnalysis(true); + configuration.setDefaultLanguageVersion(languageVersion); + configuration.setThreads(1); if (isUseAuxClasspath) { // configure the "auxclasspath" option for unit testing - config.prependClasspath("."); + configuration.prependClasspath("."); } else { // simple class loader, that doesn't delegate to parent. // this allows us in the tests to simulate PMD run without // auxclasspath, not even the classes from the test dependencies // will be found. - config.setClassLoader(new ClassLoader() { + configuration.setClassLoader(new ClassLoader() { @Override protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { if (name.startsWith("java.") || name.startsWith("javax.")) { @@ -289,7 +289,7 @@ public abstract class RuleTst { listOf(RuleSet.forSingleRule(rule)), DataSource.forString(code, "test." + languageVersion.getLanguage().getExtensions().get(0)), listener, - config + configuration ); listener.close(); diff --git a/pom.xml b/pom.xml index 2476b7959d..3f3abb530d 100644 --- a/pom.xml +++ b/pom.xml @@ -94,7 +94,7 @@ 3.0.0-M5 9.3 3.1.2 - 3.15.0 + 3.16.0 1.10.12 3.2.0 4.8