[core] Actually move into correct package lang.rule

This commit is contained in:
Andreas Dangel
2024-01-13 20:07:44 +01:00
parent 7b680eecaf
commit faaec5ed6d
151 changed files with 245 additions and 293 deletions

View File

@ -73,19 +73,19 @@ require_relative 'jdoc_namespace_tag'
# * a (args) -> adds the simple name of the argument types for method references, noop for other references
# * {% jdoc !a!core::Rule#setName(java.lang.String) %} -> [`setName(String)`](...)
# * q (qualify) -> prefix with the fqcn of the class, noop for package references
# * {% jdoc !q!core::rule.Rule %} -> [`net.sourceforge.pmd.rule.Rule`](...)
# * {% jdoc !q!core::rule.Rule#setName(java.lang.String) %} -> [`net.sourceforge.pmd.rule.Rule#setName`](...)
# * {% jdoc !q!core::rule.Rule %} -> [`net.sourceforge.pmd.lang.rule.Rule`](...)
# * {% jdoc !q!core::rule.Rule#setName(java.lang.String) %} -> [`net.sourceforge.pmd.lang.rule.Rule#setName`](...)
# * c (class) -> prefix the class name for member references, noop for type and package references, or if "qualify" is specified
# * {% jdoc !c!core::Rule#setName(java.lang.String) %} -> [`Rule#setName`](...)
# * Empty options ("!!") - > shorthand to a commonly relevant option
# * For field or method references, "!!" is the "c" option
# * {% jdoc !!core::Rule#setName(java.lang.String) %} -> [`Rule#setName`](...)
# * For type references, "!!" is the "q" option
# * {% jdoc !!core::rule.Rule %} -> [`net.sourceforge.pmd.rule.Rule`](...)
# * {% jdoc !!core::rule.Rule %} -> [`net.sourceforge.pmd.lang.rule.Rule`](...)
# * For package references, "!!" is a noop, they're always fully qualified
# * Several options may be used at once, though this is only useful for method references:
# * {% jdoc !ac!core::Rule#setName(java.lang.String) %} -> [`Rule#setName(String)`](...)
# * {% jdoc !aq!core::rule.Rule#setName(java.lang.String) %} -> [`net.sourceforge.pmd.rule.Rule#setName(String)`](...)
# * {% jdoc !aq!core::rule.Rule#setName(java.lang.String) %} -> [`net.sourceforge.pmd.lang.rule.Rule#setName(String)`](...)
#
# * DO NOT:
# - Include spaces in any part of the reference

View File

@ -155,23 +155,24 @@ in the Migration Guide.
**Moved classes/consolidated packages**
* pmd-core
* Many types have been moved from the base package `net.sourceforge.pmd` into the new subpackage {% jdoc_package core::rule %}
* {%jdoc core::rule.Rule %}
* {%jdoc core::rule.RulePriority %}
* {%jdoc core::rule.RuleSet %}
* {%jdoc core::rule.RuleSetFactory %}
* {%jdoc core::rule.RuleSetFactoryCompatibility %}
* {%jdoc core::rule.RuleSetLoader %}
* {%jdoc core::rule.RuleSetLoadException %}
* {%jdoc core::rule.RuleSetWriter %}
* Many types have been moved from the base package `net.sourceforge.pmd` into subpackage {% jdoc_package core::lang.rule %}
* {%jdoc core::lang.rule.Rule %}
* {%jdoc core::lang.rule.RulePriority %}
* {%jdoc core::lang.rule.RuleSet %}
* {%jdoc core::lang.rule.RuleSetFactory %}
* {%jdoc core::lang.rule.RuleSetFactoryCompatibility %}
* {%jdoc core::lang.rule.RuleSetLoader %}
* {%jdoc core::lang.rule.RuleSetLoadException %}
* {%jdoc core::lang.rule.RuleSetWriter %}
**Internalized classes**
These were marked as `@InternalApi` previously.
* pmd-core
* `RuleFactory`: moved from `net.sourceforge.pmd.rules`; it has now been hidden from public API.
* Many types have been moved from the base package `net.sourceforge.pmd` into the new subpackage `rule.internal`.
* `RuleFactory`: moved from `net.sourceforge.pmd.rules` into subpackage `lang.rule`.
It has now been hidden completely from public API.
* Many types have been moved from the base package `net.sourceforge.pmd` into subpackage `lang.rule.internal`.
* `RuleSetReference`
* `RuleSetReferenceId`
* `RuleSets`

View File

@ -19,7 +19,7 @@ import org.apache.tools.ant.types.Resource;
import net.sourceforge.pmd.annotation.InternalApi;
import net.sourceforge.pmd.ant.internal.PMDTaskImpl;
import net.sourceforge.pmd.rule.RulePriority;
import net.sourceforge.pmd.lang.rule.RulePriority;
/**
* PMD Ant task. Setters of this class are interpreted by Ant as properties

View File

@ -33,12 +33,12 @@ import net.sourceforge.pmd.lang.Language;
import net.sourceforge.pmd.lang.LanguageRegistry;
import net.sourceforge.pmd.lang.LanguageVersion;
import net.sourceforge.pmd.lang.document.TextFile;
import net.sourceforge.pmd.lang.rule.RulePriority;
import net.sourceforge.pmd.lang.rule.RuleSetLoader;
import net.sourceforge.pmd.reporting.FileAnalysisListener;
import net.sourceforge.pmd.reporting.GlobalAnalysisListener;
import net.sourceforge.pmd.reporting.ReportStats;
import net.sourceforge.pmd.reporting.ReportStatsListener;
import net.sourceforge.pmd.rule.RulePriority;
import net.sourceforge.pmd.rule.RuleSetLoader;
public class PMDTaskImpl {

View File

@ -29,7 +29,7 @@ import net.sourceforge.pmd.lang.apex.ast.ASTUserEnum;
import net.sourceforge.pmd.lang.apex.ast.ASTVariableDeclarationStatements;
import net.sourceforge.pmd.lang.apex.ast.ApexNode;
import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.rule.Rule;
import net.sourceforge.pmd.lang.rule.Rule;
final class ApexViolationSuppressors {

View File

@ -9,9 +9,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
import net.sourceforge.pmd.rule.AbstractRuleSetFactoryTest;
import net.sourceforge.pmd.rule.RuleSet;
import net.sourceforge.pmd.rule.RuleSetLoader;
import net.sourceforge.pmd.lang.rule.AbstractRuleSetFactoryTest;
import net.sourceforge.pmd.lang.rule.RuleSet;
import net.sourceforge.pmd.lang.rule.RuleSetLoader;
import com.github.stefanbirkner.systemlambda.SystemLambda;

View File

@ -4,7 +4,7 @@
package net.sourceforge.pmd.lang.apex;
import net.sourceforge.pmd.rule.AbstractRuleSetFactoryTest;
import net.sourceforge.pmd.lang.rule.AbstractRuleSetFactoryTest;
class RuleSetFactoryTest extends AbstractRuleSetFactoryTest {
// no additional tests yet

View File

@ -21,10 +21,10 @@ import net.sourceforge.pmd.lang.Language;
import net.sourceforge.pmd.lang.LanguageVersion;
import net.sourceforge.pmd.lang.apex.ApexLanguageModule;
import net.sourceforge.pmd.lang.apex.ApexLanguageProperties;
import net.sourceforge.pmd.lang.rule.Rule;
import net.sourceforge.pmd.lang.rule.RuleSet;
import net.sourceforge.pmd.lang.rule.RuleSetLoader;
import net.sourceforge.pmd.reporting.GlobalAnalysisListener;
import net.sourceforge.pmd.rule.Rule;
import net.sourceforge.pmd.rule.RuleSet;
import net.sourceforge.pmd.rule.RuleSetLoader;
import com.nawforce.pkgforce.path.PathFactory;
import com.nawforce.pkgforce.path.PathLike;

View File

@ -32,11 +32,11 @@ import net.sourceforge.pmd.cli.internal.ProgressBarListener;
import net.sourceforge.pmd.internal.LogMessages;
import net.sourceforge.pmd.lang.Language;
import net.sourceforge.pmd.lang.LanguageVersion;
import net.sourceforge.pmd.lang.rule.RulePriority;
import net.sourceforge.pmd.properties.PropertyDescriptor;
import net.sourceforge.pmd.renderers.Renderer;
import net.sourceforge.pmd.renderers.RendererFactory;
import net.sourceforge.pmd.reporting.ReportStats;
import net.sourceforge.pmd.rule.RulePriority;
import net.sourceforge.pmd.util.StringUtil;
import net.sourceforge.pmd.util.log.MessageReporter;
import net.sourceforge.pmd.util.log.internal.SimpleMessageReporter;

View File

@ -8,7 +8,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.sourceforge.pmd.rule.RulePriority;
import net.sourceforge.pmd.lang.rule.RulePriority;
import picocli.CommandLine.ITypeConverter;
import picocli.CommandLine.TypeConversionException;

View File

@ -33,9 +33,9 @@ import net.sourceforge.pmd.cache.NoopAnalysisCache;
import net.sourceforge.pmd.internal.util.ClasspathClassLoader;
import net.sourceforge.pmd.lang.Language;
import net.sourceforge.pmd.lang.LanguageRegistry;
import net.sourceforge.pmd.lang.rule.RuleSetLoader;
import net.sourceforge.pmd.renderers.Renderer;
import net.sourceforge.pmd.renderers.RendererFactory;
import net.sourceforge.pmd.rule.RuleSetLoader;
import net.sourceforge.pmd.util.AssertionUtil;
import net.sourceforge.pmd.util.log.internal.SimpleMessageReporter;
@ -596,7 +596,7 @@ public class PMDConfiguration extends AbstractConfiguration {
}
// new method to be compatible with PMD 7 - RulePriority has changed package
public net.sourceforge.pmd.rule.RulePriority getMinimumPriority$$bridge() { // SUPPRESS CHECKSTYLE ignore
public net.sourceforge.pmd.lang.rule.RulePriority getMinimumPriority$$bridge() { // SUPPRESS CHECKSTYLE ignore
return minimumPriority.asPMD7RulePriority();
}
}

View File

@ -16,12 +16,12 @@ import net.sourceforge.pmd.lang.Language;
import net.sourceforge.pmd.lang.LanguageProcessor;
import net.sourceforge.pmd.lang.LanguageVersion;
import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.rule.RulePriority;
import net.sourceforge.pmd.lang.rule.RuleSet;
import net.sourceforge.pmd.lang.rule.RuleTargetSelector;
import net.sourceforge.pmd.properties.PropertyDescriptor;
import net.sourceforge.pmd.properties.PropertyFactory;
import net.sourceforge.pmd.properties.PropertySource;
import net.sourceforge.pmd.rule.RulePriority;
import net.sourceforge.pmd.rule.RuleSet;
/**
* This is the basic Rule interface for PMD rules.
@ -311,7 +311,7 @@ public interface Rule extends PropertySource {
* Creates a new copy of this rule.
* @return A new exact copy of this rule
*/
net.sourceforge.pmd.rule.Rule deepCopy();
net.sourceforge.pmd.lang.rule.Rule deepCopy();
// new method to be compatible with PMD 6 - Rule has changed package
default Rule deepCopy$$bridge() { // SUPPRESS CHECKSTYLE ignore

View File

@ -2,7 +2,7 @@
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
// Copy of net.sourceforge.pmd.rule.RulePriority
// Copy of net.sourceforge.pmd.lang.rule.RulePriority
// Added method:
// - asPMD7RulePriority
@ -130,7 +130,9 @@ public enum RulePriority {
}
}
public net.sourceforge.pmd.rule.RulePriority asPMD7RulePriority() {
return net.sourceforge.pmd.rule.RulePriority.valueOf(name());
// ---- compatibility extensions
public net.sourceforge.pmd.lang.rule.RulePriority asPMD7RulePriority() {
return net.sourceforge.pmd.lang.rule.RulePriority.valueOf(name());
}
}

View File

@ -6,7 +6,7 @@ package net.sourceforge.pmd;
import org.checkerframework.checker.nullness.qual.NonNull;
public class RuleSetLoadException extends net.sourceforge.pmd.rule.RuleSetLoadException {
public class RuleSetLoadException extends net.sourceforge.pmd.lang.rule.RuleSetLoadException {
public RuleSetLoadException(RuleSetReferenceId rsetId, @NonNull Throwable cause) {
super(rsetId, cause);
}

View File

@ -15,7 +15,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import net.sourceforge.pmd.rule.RuleSet;
import net.sourceforge.pmd.lang.rule.RuleSet;
public final class RuleSetLoader {
public RuleSetLoader warnDeprecated(boolean warn) {

View File

@ -4,7 +4,7 @@
package net.sourceforge.pmd;
public class RuleSetReferenceId extends net.sourceforge.pmd.rule.internal.RuleSetReferenceId {
public class RuleSetReferenceId extends net.sourceforge.pmd.lang.rule.internal.RuleSetReferenceId {
public RuleSetReferenceId(String id) {
super(id);
}

View File

@ -70,7 +70,7 @@ public interface RuleViolation {
*
* @return The identifying Rule.
*/
net.sourceforge.pmd.rule.Rule getRule();
net.sourceforge.pmd.lang.rule.Rule getRule();
/**
* Get the description of this violation.

View File

@ -5,7 +5,7 @@
// The class net.sourceforge.pmd.Rule has been moved into sub-package rule
// in 7.0.0-SNAPSHOT. All rules should be interchangeable.
package net.sourceforge.pmd.rule;
package net.sourceforge.pmd.lang.rule;
public interface Rule extends net.sourceforge.pmd.Rule {
}

View File

@ -27,10 +27,10 @@ import net.sourceforge.pmd.cache.NoopAnalysisCache;
import net.sourceforge.pmd.internal.util.ClasspathClassLoader;
import net.sourceforge.pmd.lang.Language;
import net.sourceforge.pmd.lang.LanguageRegistry;
import net.sourceforge.pmd.lang.rule.RulePriority;
import net.sourceforge.pmd.lang.rule.RuleSetLoader;
import net.sourceforge.pmd.renderers.Renderer;
import net.sourceforge.pmd.renderers.RendererFactory;
import net.sourceforge.pmd.rule.RulePriority;
import net.sourceforge.pmd.rule.RuleSetLoader;
import net.sourceforge.pmd.util.AssertionUtil;
import net.sourceforge.pmd.util.log.internal.SimpleMessageReporter;

View File

@ -42,6 +42,10 @@ import net.sourceforge.pmd.lang.LanguageVersion;
import net.sourceforge.pmd.lang.LanguageVersionDiscoverer;
import net.sourceforge.pmd.lang.document.FileCollector;
import net.sourceforge.pmd.lang.document.TextFile;
import net.sourceforge.pmd.lang.rule.Rule;
import net.sourceforge.pmd.lang.rule.RuleSet;
import net.sourceforge.pmd.lang.rule.RuleSetLoader;
import net.sourceforge.pmd.lang.rule.internal.RuleSets;
import net.sourceforge.pmd.renderers.Renderer;
import net.sourceforge.pmd.reporting.ConfigurableFileNameRenderer;
import net.sourceforge.pmd.reporting.FileAnalysisListener;
@ -49,10 +53,6 @@ import net.sourceforge.pmd.reporting.GlobalAnalysisListener;
import net.sourceforge.pmd.reporting.ListenerInitializer;
import net.sourceforge.pmd.reporting.ReportStats;
import net.sourceforge.pmd.reporting.ReportStatsListener;
import net.sourceforge.pmd.rule.Rule;
import net.sourceforge.pmd.rule.RuleSet;
import net.sourceforge.pmd.rule.RuleSetLoader;
import net.sourceforge.pmd.rule.internal.RuleSets;
import net.sourceforge.pmd.util.AssertionUtil;
import net.sourceforge.pmd.util.StringUtil;
import net.sourceforge.pmd.util.log.MessageReporter;

View File

@ -20,10 +20,10 @@ import net.sourceforge.pmd.annotation.Experimental;
import net.sourceforge.pmd.annotation.InternalApi;
import net.sourceforge.pmd.lang.document.FileId;
import net.sourceforge.pmd.lang.document.TextFile;
import net.sourceforge.pmd.lang.rule.Rule;
import net.sourceforge.pmd.renderers.AbstractAccumulatingRenderer;
import net.sourceforge.pmd.reporting.FileAnalysisListener;
import net.sourceforge.pmd.reporting.GlobalAnalysisListener;
import net.sourceforge.pmd.rule.Rule;
import net.sourceforge.pmd.util.BaseResultProducingCloseable;
/**

View File

@ -23,10 +23,10 @@ import net.sourceforge.pmd.lang.document.FileLocation;
import net.sourceforge.pmd.lang.document.TextRange2d;
import net.sourceforge.pmd.lang.rule.AbstractRule;
import net.sourceforge.pmd.lang.rule.ParametricRuleViolation;
import net.sourceforge.pmd.lang.rule.Rule;
import net.sourceforge.pmd.properties.PropertyDescriptor;
import net.sourceforge.pmd.reporting.FileAnalysisListener;
import net.sourceforge.pmd.reporting.ViolationDecorator;
import net.sourceforge.pmd.rule.Rule;
/**
* The API for rules to report violations or errors during analysis.

View File

@ -10,7 +10,7 @@ import java.util.Map;
import net.sourceforge.pmd.annotation.DeprecatedUntil700;
import net.sourceforge.pmd.lang.document.FileId;
import net.sourceforge.pmd.lang.document.FileLocation;
import net.sourceforge.pmd.rule.Rule;
import net.sourceforge.pmd.lang.rule.Rule;
/**
* A RuleViolation is created by a Rule when it identifies a violation of the

View File

@ -15,10 +15,10 @@ import org.checkerframework.checker.nullness.qual.Nullable;
import net.sourceforge.pmd.Report.SuppressedViolation;
import net.sourceforge.pmd.lang.ast.AstInfo;
import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.rule.Rule;
import net.sourceforge.pmd.lang.rule.xpath.XPathVersion;
import net.sourceforge.pmd.lang.rule.xpath.internal.DeprecatedAttrLogger;
import net.sourceforge.pmd.lang.rule.xpath.internal.SaxonXPathRuleQuery;
import net.sourceforge.pmd.rule.Rule;
/**
* An object that suppresses rule violations. Suppressors are used by

View File

@ -37,8 +37,8 @@ import net.sourceforge.pmd.internal.util.IOUtil;
import net.sourceforge.pmd.lang.document.FileId;
import net.sourceforge.pmd.lang.document.TextDocument;
import net.sourceforge.pmd.lang.document.TextFile;
import net.sourceforge.pmd.lang.rule.internal.RuleSets;
import net.sourceforge.pmd.reporting.FileAnalysisListener;
import net.sourceforge.pmd.rule.internal.RuleSets;
/**
* Abstract implementation of the analysis cache. Handles all operations, except for persistence.

View File

@ -12,9 +12,9 @@ import net.sourceforge.pmd.RuleViolation;
import net.sourceforge.pmd.annotation.InternalApi;
import net.sourceforge.pmd.lang.document.TextDocument;
import net.sourceforge.pmd.lang.document.TextFile;
import net.sourceforge.pmd.lang.rule.internal.RuleSets;
import net.sourceforge.pmd.reporting.FileAnalysisListener;
import net.sourceforge.pmd.reporting.GlobalAnalysisListener;
import net.sourceforge.pmd.rule.internal.RuleSets;
/**
* An analysis cache for incremental analysis.

View File

@ -9,9 +9,9 @@ import java.util.Collection;
import net.sourceforge.pmd.annotation.InternalApi;
import net.sourceforge.pmd.lang.document.TextFile;
import net.sourceforge.pmd.lang.rule.internal.RuleSets;
import net.sourceforge.pmd.reporting.FileAnalysisListener;
import net.sourceforge.pmd.reporting.GlobalAnalysisListener;
import net.sourceforge.pmd.rule.internal.RuleSets;
/**
* Adapter to wrap {@link AnalysisCache} behaviour in a {@link GlobalAnalysisListener}.

View File

@ -8,8 +8,8 @@ import java.util.HashMap;
import java.util.Map;
import net.sourceforge.pmd.annotation.InternalApi;
import net.sourceforge.pmd.rule.Rule;
import net.sourceforge.pmd.rule.internal.RuleSets;
import net.sourceforge.pmd.lang.rule.Rule;
import net.sourceforge.pmd.lang.rule.internal.RuleSets;
/**
* A mapper from rule class names to rule instances for cached rules.

View File

@ -19,7 +19,7 @@ import net.sourceforge.pmd.annotation.InternalApi;
import net.sourceforge.pmd.lang.document.FileId;
import net.sourceforge.pmd.lang.document.FileLocation;
import net.sourceforge.pmd.lang.document.TextRange2d;
import net.sourceforge.pmd.rule.Rule;
import net.sourceforge.pmd.lang.rule.Rule;
import net.sourceforge.pmd.util.StringUtil;
/**

View File

@ -26,7 +26,7 @@ import net.sourceforge.pmd.benchmark.TimedOperation;
import net.sourceforge.pmd.benchmark.TimedOperationCategory;
import net.sourceforge.pmd.lang.document.FileId;
import net.sourceforge.pmd.lang.document.TextFile;
import net.sourceforge.pmd.rule.internal.RuleSets;
import net.sourceforge.pmd.lang.rule.internal.RuleSets;
/**
* An analysis cache backed by a regular file.

Some files were not shown because too many files have changed in this diff Show More