From ac864aa5294a9caa72827fd8400c8db1337c3897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 26 Oct 2020 19:29:19 +0100 Subject: [PATCH] Rename --- .../pmd/lang/apex/DefaultRulesetTest.java | 4 +- .../main/java/net/sourceforge/pmd/PMD.java | 3 +- .../net/sourceforge/pmd/RuleSetFactory.java | 103 ++---------------- .../pmd/RuleSetFactoryCompatibility.java | 3 +- .../sourceforge/pmd/RuleSetParserConfig.java | 96 ++++++++++++++++ .../sourceforge/pmd/RulesetsFactoryUtils.java | 13 +-- .../pmd/ant/internal/PMDTaskImpl.java | 8 +- .../sourceforge/pmd/RuleSetFactoryTest.java | 17 ++- .../pmd/lang/java/PMD5RulesetTest.java | 4 +- .../pmd/lang/java/QuickstartRulesetTest.java | 4 +- .../lang/scala/ast/ScalaParsingHelper.java | 4 +- 11 files changed, 135 insertions(+), 124 deletions(-) create mode 100644 pmd-core/src/main/java/net/sourceforge/pmd/RuleSetParserConfig.java diff --git a/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/DefaultRulesetTest.java b/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/DefaultRulesetTest.java index 7cf90ce8f6..c2d76f7d1f 100644 --- a/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/DefaultRulesetTest.java +++ b/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/DefaultRulesetTest.java @@ -16,13 +16,13 @@ import org.junit.contrib.java.lang.system.SystemErrRule; import net.sourceforge.pmd.RuleSet; import net.sourceforge.pmd.RuleSetFactory; -import net.sourceforge.pmd.RuleSetFactory.RuleSetFactoryConfig; +import net.sourceforge.pmd.RuleSetParserConfig; public class DefaultRulesetTest { @Rule public final SystemErrRule systemErrRule = new SystemErrRule().enableLog().muteForSuccessfulTests(); - private RuleSetFactory factory = new RuleSetFactoryConfig().enableCompatibility(false).createFactory(); + private RuleSetFactory factory = new RuleSetParserConfig().enableCompatibility(false).createFactory(); @Test public void loadDefaultRuleset() throws Exception { 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 5a4b864375..c7aaf5877e 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java @@ -21,7 +21,6 @@ import java.util.logging.ConsoleHandler; import java.util.logging.Level; import java.util.logging.Logger; -import net.sourceforge.pmd.RuleSetFactory.RuleSetFactoryConfig; import net.sourceforge.pmd.benchmark.TextTimingReportRenderer; import net.sourceforge.pmd.benchmark.TimeTracker; import net.sourceforge.pmd.benchmark.TimedOperation; @@ -203,7 +202,7 @@ public class PMD { public static int doPMD(PMDConfiguration configuration) { // Load the RuleSets - final RuleSetFactory ruleSetFactory = RuleSetFactoryConfig.fromPmdConfig(configuration).createFactory(); + final RuleSetFactory ruleSetFactory = RuleSetParserConfig.fromPmdConfig(configuration).createFactory(); final RuleSets ruleSets = RulesetsFactoryUtils.getRuleSetsWithBenchmark(configuration.getRuleSets(), ruleSetFactory); if (ruleSets == null) { return PMDCommandLineInterface.NO_ERRORS_STATUS; diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactory.java b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactory.java index e248c3ee86..6163e96c89 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactory.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactory.java @@ -44,9 +44,9 @@ import net.sourceforge.pmd.util.ResourceLoader; /** * RuleSetFactory is responsible for creating RuleSet instances from XML - * content. See {@link RuleSetFactoryConfig} for configuration options and + * content. See {@link RuleSetParserConfig} for configuration options and * their defaults. The constructors of this class are deprecated and their - * usages should be replaced by use of {@link RuleSetFactoryConfig#createFactory()}. + * usages should be replaced by use of {@link RuleSetParserConfig#createFactory()}. */ public class RuleSetFactory { @@ -65,7 +65,7 @@ public class RuleSetFactory { private final Map parsedRulesets = new HashMap<>(); /** - * @deprecated Use a {@link RuleSetFactoryConfig} to build a new factory + * @deprecated Use a {@link RuleSetParserConfig} to build a new factory */ @Deprecated // to be removed with PMD 7.0.0. public RuleSetFactory() { @@ -73,7 +73,7 @@ public class RuleSetFactory { } /** - * @deprecated Use a {@link RuleSetFactoryConfig} to build a new factory + * @deprecated Use a {@link RuleSetParserConfig} to build a new factory */ @Deprecated // to be removed with PMD 7.0.0. public RuleSetFactory(final ClassLoader classLoader, final RulePriority minimumPriority, @@ -82,7 +82,7 @@ public class RuleSetFactory { } /** - * @deprecated Use a {@link RuleSetFactoryConfig} to build a new factory + * @deprecated Use a {@link RuleSetParserConfig} to build a new factory */ @Deprecated // to be hidden with PMD 7.0.0. public RuleSetFactory(final ResourceLoader resourceLoader, final RulePriority minimumPriority, @@ -121,7 +121,7 @@ public class RuleSetFactory { } - RuleSetFactory(RuleSetFactoryConfig config) { + RuleSetFactory(RuleSetParserConfig config) { this(config.resourceLoader, config.minimumPriority, config.warnDeprecated, config.enableCompatibility, config.includeDeprecatedRuleReferences); } @@ -838,93 +838,12 @@ public class RuleSetFactory { } - public RuleSetFactoryConfig toConfig() { - return new RuleSetFactoryConfig().loadResourcesWith(resourceLoader) - .filterAbovePriority(minimumPriority) - .warnDeprecated(warnDeprecated) - .enableCompatibility(compatibilityFilter != null); + public RuleSetParserConfig toConfig() { + return new RuleSetParserConfig().loadResourcesWith(resourceLoader) + .filterAbovePriority(minimumPriority) + .warnDeprecated(warnDeprecated) + .enableCompatibility(compatibilityFilter != null); } - /** - * Configuration of a {@link RuleSetFactory}. This is a fluent builder - * pattern. Use this instead of the constructors of RuleSetFactory. - */ - public static final class RuleSetFactoryConfig { - - ResourceLoader resourceLoader = new ResourceLoader(RuleSetFactoryConfig.class.getClassLoader()); - RulePriority minimumPriority = RulePriority.LOW; - boolean warnDeprecated = true; - boolean enableCompatibility = true; - boolean includeDeprecatedRuleReferences = false; - - /** - * Specify that the given classloader should be used to resolve - * paths to external ruleset references. The default uses PMD's - * own classpath. - */ - public RuleSetFactoryConfig loadResourcesWith(ClassLoader classLoader) { - this.resourceLoader = new ResourceLoader(classLoader); - return this; - } - - // internal - RuleSetFactoryConfig loadResourcesWith(ResourceLoader loader) { - this.resourceLoader = loader; - return this; - } - - /** - * Filter loaded rules to only those that match or are above - * the given priority. The default is {@link RulePriority#LOW}, - * ie, no filtering occurs. - */ - public RuleSetFactoryConfig filterAbovePriority(RulePriority minimumPriority) { - this.minimumPriority = minimumPriority; - return this; - } - - /** - * Log a warning when referencing a deprecated rule. - * This is enabled by default. - */ - public RuleSetFactoryConfig warnDeprecated(boolean warn) { - this.warnDeprecated = warn; - return this; - } - - /** - * Enable translating old rule references to newer ones, if they have - * been moved or renamed. This is enabled by default, if disabled, - * unresolved references will not be translated and will produce an - * error. - */ - public RuleSetFactoryConfig enableCompatibility(boolean enable) { - this.enableCompatibility = enable; - return this; - } - - /** - * Follow deprecated rule references. By default this is off, - * and those references will be ignored (with a warning depending - * on {@link #enableCompatibility(boolean)}). - */ - public RuleSetFactoryConfig includeDeprecatedRuleReferences(boolean enable) { - this.includeDeprecatedRuleReferences = enable; - return this; - } - - public RuleSetFactory createFactory() { - return new RuleSetFactory(this); - } - - /** - * Configure a new ruleset factory builder according to the parameters - * of the given PMD configuration. - */ - public static RuleSetFactoryConfig fromPmdConfig(PMDConfiguration configuration) { - return new RuleSetFactoryConfig().filterAbovePriority(configuration.getMinimumPriority()) - .enableCompatibility(configuration.isRuleSetFactoryCompatibilityEnabled()); - } - } } diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactoryCompatibility.java b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactoryCompatibility.java index a0008ab3b4..26393af8ea 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactoryCompatibility.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactoryCompatibility.java @@ -18,7 +18,6 @@ import java.util.regex.Pattern; import org.apache.commons.io.IOUtils; -import net.sourceforge.pmd.RuleSetFactory.RuleSetFactoryConfig; import net.sourceforge.pmd.annotation.InternalApi; /** @@ -28,7 +27,7 @@ import net.sourceforge.pmd.annotation.InternalApi; * * @see issue 1360 * - * @deprecated Use {@link RuleSetFactoryConfig#enableCompatibility(boolean)} to enable this feature. + * @deprecated Use {@link RuleSetParserConfig#enableCompatibility(boolean)} to enable this feature. * This implementation is internal API. */ @InternalApi diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetParserConfig.java b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetParserConfig.java new file mode 100644 index 0000000000..c1b1f6fe15 --- /dev/null +++ b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetParserConfig.java @@ -0,0 +1,96 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd; + +import net.sourceforge.pmd.util.ResourceLoader; + +/** + * Configuration of a {@link RuleSetFactory}. This is a fluent builder + * pattern. Use this instead of the constructors of RuleSetFactory. + */ +public final class RuleSetParserConfig { + + ResourceLoader resourceLoader = new ResourceLoader(RuleSetParserConfig.class.getClassLoader()); + RulePriority minimumPriority = RulePriority.LOW; + boolean warnDeprecated = true; + boolean enableCompatibility = true; + boolean includeDeprecatedRuleReferences = false; + + /** + * Create a new config with the default values. + */ + public RuleSetParserConfig() { + + } + + /** + * Specify that the given classloader should be used to resolve + * paths to external ruleset references. The default uses PMD's + * own classpath. + */ + public RuleSetParserConfig loadResourcesWith(ClassLoader classLoader) { + this.resourceLoader = new ResourceLoader(classLoader); + return this; + } + + // internal + RuleSetParserConfig loadResourcesWith(ResourceLoader loader) { + this.resourceLoader = loader; + return this; + } + + /** + * Filter loaded rules to only those that match or are above + * the given priority. The default is {@link RulePriority#LOW}, + * ie, no filtering occurs. + */ + public RuleSetParserConfig filterAbovePriority(RulePriority minimumPriority) { + this.minimumPriority = minimumPriority; + return this; + } + + /** + * Log a warning when referencing a deprecated rule. + * This is enabled by default. + */ + public RuleSetParserConfig warnDeprecated(boolean warn) { + this.warnDeprecated = warn; + return this; + } + + /** + * Enable translating old rule references to newer ones, if they have + * been moved or renamed. This is enabled by default, if disabled, + * unresolved references will not be translated and will produce an + * error. + */ + public RuleSetParserConfig enableCompatibility(boolean enable) { + this.enableCompatibility = enable; + return this; + } + + /** + * Follow deprecated rule references. By default this is off, + * and those references will be ignored (with a warning depending + * on {@link #enableCompatibility(boolean)}). + */ + public RuleSetParserConfig includeDeprecatedRuleReferences(boolean enable) { + this.includeDeprecatedRuleReferences = enable; + return this; + } + + public RuleSetFactory createFactory() { + return new RuleSetFactory(this); + } + + /** + * Configure a new ruleset factory builder according to the parameters + * of the given PMD configuration. + */ + public static RuleSetParserConfig fromPmdConfig(PMDConfiguration configuration) { + return new RuleSetParserConfig().filterAbovePriority(configuration.getMinimumPriority()) + .enableCompatibility(configuration.isRuleSetFactoryCompatibilityEnabled()); + } +} diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/RulesetsFactoryUtils.java b/pmd-core/src/main/java/net/sourceforge/pmd/RulesetsFactoryUtils.java index 609c7b6549..bba3ef5f55 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/RulesetsFactoryUtils.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/RulesetsFactoryUtils.java @@ -7,7 +7,6 @@ package net.sourceforge.pmd; import java.util.logging.Level; import java.util.logging.Logger; -import net.sourceforge.pmd.RuleSetFactory.RuleSetFactoryConfig; import net.sourceforge.pmd.annotation.InternalApi; import net.sourceforge.pmd.benchmark.TimeTracker; import net.sourceforge.pmd.benchmark.TimedOperation; @@ -77,7 +76,7 @@ public final class RulesetsFactoryUtils { } /** - * @deprecated Use a {@link RuleSetFactoryConfig} + * @deprecated Use a {@link RuleSetParserConfig} */ @InternalApi @Deprecated @@ -98,7 +97,7 @@ public final class RulesetsFactoryUtils { * * @see #createFactory(PMDConfiguration, ClassLoader) * - * @deprecated Use {@link RuleSetFactoryConfig#fromPmdConfig(PMDConfiguration)} + * @deprecated Use {@link RuleSetParserConfig#fromPmdConfig(PMDConfiguration)} */ @Deprecated public static RuleSetFactory createFactory(final PMDConfiguration configuration) { @@ -111,7 +110,7 @@ public final class RulesetsFactoryUtils { * * @return A ruleset factory * - * @see RuleSetFactoryConfig + * @see RuleSetParserConfig */ public static RuleSetFactory defaultFactory() { return new RuleSetFactory(); @@ -129,7 +128,7 @@ public final class RulesetsFactoryUtils { * * @see #createFactory(PMDConfiguration) * - * @deprecated Use a {@link RuleSetFactoryConfig} + * @deprecated Use a {@link RuleSetParserConfig} */ @Deprecated public static RuleSetFactory createFactory(final PMDConfiguration configuration, ClassLoader classLoader) { @@ -153,7 +152,7 @@ public final class RulesetsFactoryUtils { * * @see #createFactory(PMDConfiguration) * - * @deprecated Use a {@link RuleSetFactoryConfig} + * @deprecated Use a {@link RuleSetParserConfig} */ @Deprecated public static RuleSetFactory createFactory(ClassLoader classLoader, @@ -177,7 +176,7 @@ public final class RulesetsFactoryUtils { * * @see #createFactory(PMDConfiguration) * - * @deprecated Use a {@link RuleSetFactoryConfig} + * @deprecated Use a {@link RuleSetParserConfig} */ @Deprecated public static RuleSetFactory createFactory(RulePriority minimumPriority, diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/ant/internal/PMDTaskImpl.java b/pmd-core/src/main/java/net/sourceforge/pmd/ant/internal/PMDTaskImpl.java index 0abe673de8..6a8b4750de 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/ant/internal/PMDTaskImpl.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/ant/internal/PMDTaskImpl.java @@ -29,7 +29,7 @@ import net.sourceforge.pmd.RuleContext; import net.sourceforge.pmd.RulePriority; import net.sourceforge.pmd.RuleSet; import net.sourceforge.pmd.RuleSetFactory; -import net.sourceforge.pmd.RuleSetFactory.RuleSetFactoryConfig; +import net.sourceforge.pmd.RuleSetParserConfig; import net.sourceforge.pmd.RuleSetNotFoundException; import net.sourceforge.pmd.RuleSets; import net.sourceforge.pmd.ant.Formatter; @@ -102,9 +102,9 @@ public class PMDTaskImpl { setupClassLoader(); // Setup RuleSetFactory and validate RuleSets - RuleSetFactory ruleSetFactory = RuleSetFactoryConfig.fromPmdConfig(configuration) - .loadResourcesWith(setupResourceLoader()) - .createFactory(); + RuleSetFactory ruleSetFactory = RuleSetParserConfig.fromPmdConfig(configuration) + .loadResourcesWith(setupResourceLoader()) + .createFactory(); try { // This is just used to validate and display rules. Each thread will create its own ruleset diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/RuleSetFactoryTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/RuleSetFactoryTest.java index 840def81e1..75de7f2189 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/RuleSetFactoryTest.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/RuleSetFactoryTest.java @@ -23,7 +23,6 @@ import org.apache.commons.lang3.StringUtils; import org.junit.Test; import org.junit.rules.ExpectedException; -import net.sourceforge.pmd.RuleSetFactory.RuleSetFactoryConfig; import net.sourceforge.pmd.junit.JavaUtilLoggingRule; import net.sourceforge.pmd.junit.LocaleRule; import net.sourceforge.pmd.lang.DummyLanguageModule; @@ -506,7 +505,7 @@ public class RuleSetFactoryTest { @Test public void testReferencePriority() throws RuleSetNotFoundException { - RuleSetFactoryConfig config = new RuleSetFactoryConfig().warnDeprecated(false).enableCompatibility(true); + RuleSetParserConfig config = new RuleSetParserConfig().warnDeprecated(false).enableCompatibility(true); RuleSetFactory rsf = config.filterAbovePriority(RulePriority.LOW).createFactory(); RuleSet ruleSet = rsf.createRuleSet(createRuleSetReferenceId(REF_INTERNAL_TO_INTERNAL_CHAIN)); @@ -547,7 +546,7 @@ public class RuleSetFactoryTest { @Test public void testOverridePriorityLoadWithMinimum() throws RuleSetNotFoundException { - RuleSetFactory rsf = new RuleSetFactoryConfig().filterAbovePriority(RulePriority.MEDIUM_LOW).warnDeprecated(true).enableCompatibility(true).createFactory(); + RuleSetFactory rsf = new RuleSetParserConfig().filterAbovePriority(RulePriority.MEDIUM_LOW).warnDeprecated(true).enableCompatibility(true).createFactory(); RuleSet ruleset = rsf.createRuleSet("net/sourceforge/pmd/rulesets/ruleset-minimum-priority.xml"); // only one rule should remain, since we filter out the other rule by minimum priority assertEquals("Number of Rules", 1, ruleset.getRules().size()); @@ -568,13 +567,13 @@ public class RuleSetFactoryTest { @Test public void testExcludeWithMinimumPriority() throws RuleSetNotFoundException { - RuleSetFactory rsf = new RuleSetFactoryConfig().filterAbovePriority(RulePriority.HIGH).createFactory(); + RuleSetFactory rsf = new RuleSetParserConfig().filterAbovePriority(RulePriority.HIGH).createFactory(); RuleSet ruleset = rsf.createRuleSet("net/sourceforge/pmd/rulesets/ruleset-minimum-priority-exclusion.xml"); // no rules should be loaded assertEquals("Number of Rules", 0, ruleset.getRules().size()); // now, load with default minimum priority - rsf = new RuleSetFactoryConfig().filterAbovePriority(RulePriority.LOW).createFactory(); + rsf = new RuleSetParserConfig().filterAbovePriority(RulePriority.LOW).createFactory(); ruleset = rsf.createRuleSet("net/sourceforge/pmd/rulesets/ruleset-minimum-priority-exclusion.xml"); // only one rule, we have excluded one... assertEquals("Number of Rules", 1, ruleset.getRules().size()); @@ -603,9 +602,9 @@ public class RuleSetFactoryTest { @Test public void testSetPriority() throws RuleSetNotFoundException { - RuleSetFactory rsf = new RuleSetFactoryConfig().filterAbovePriority(RulePriority.MEDIUM_HIGH).warnDeprecated(false).createFactory(); + RuleSetFactory rsf = new RuleSetParserConfig().filterAbovePriority(RulePriority.MEDIUM_HIGH).warnDeprecated(false).createFactory(); assertEquals(0, rsf.createRuleSet(createRuleSetReferenceId(SINGLE_RULE)).size()); - rsf = new RuleSetFactoryConfig().filterAbovePriority(RulePriority.MEDIUM_LOW).warnDeprecated(false).createFactory(); + rsf = new RuleSetParserConfig().filterAbovePriority(RulePriority.MEDIUM_LOW).warnDeprecated(false).createFactory(); assertEquals(1, rsf.createRuleSet(createRuleSetReferenceId(SINGLE_RULE)).size()); } @@ -780,7 +779,7 @@ public class RuleSetFactoryTest { + " Ruleset which references a empty ruleset\n" + "\n" + " \n" + "\n"); - RuleSetFactory ruleSetFactory = new RuleSetFactoryConfig().loadResourcesWith(new ResourceLoader()).filterAbovePriority(RulePriority.LOW).warnDeprecated(true).enableCompatibility(true).createFactory(); + RuleSetFactory ruleSetFactory = new RuleSetParserConfig().loadResourcesWith(new ResourceLoader()).filterAbovePriority(RulePriority.LOW).warnDeprecated(true).enableCompatibility(true).createFactory(); RuleSet ruleset = ruleSetFactory.createRuleSet(ref); assertEquals(0, ruleset.getRules().size()); @@ -1285,7 +1284,7 @@ public class RuleSetFactoryTest { } private RuleSet loadRuleSetWithDeprecationWarnings(String ruleSetXml) throws RuleSetNotFoundException { - RuleSetFactory rsf = new RuleSetFactoryConfig().warnDeprecated(true).enableCompatibility(false).createFactory(); + RuleSetFactory rsf = new RuleSetParserConfig().warnDeprecated(true).enableCompatibility(false).createFactory(); return rsf.createRuleSet(createRuleSetReferenceId(ruleSetXml)); } diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/PMD5RulesetTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/PMD5RulesetTest.java index 135294a762..7954efdc88 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/PMD5RulesetTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/PMD5RulesetTest.java @@ -9,13 +9,13 @@ import org.junit.Test; import net.sourceforge.pmd.RuleSet; import net.sourceforge.pmd.RuleSetFactory; -import net.sourceforge.pmd.RuleSetFactory.RuleSetFactoryConfig; +import net.sourceforge.pmd.RuleSetParserConfig; public class PMD5RulesetTest { @Test public void loadRuleset() throws Exception { - RuleSetFactory ruleSetFactory = new RuleSetFactoryConfig().createFactory(); + RuleSetFactory ruleSetFactory = new RuleSetParserConfig().createFactory(); RuleSet ruleset = ruleSetFactory.createRuleSet("net/sourceforge/pmd/lang/java/pmd5ruleset.xml"); Assert.assertNotNull(ruleset); Assert.assertNull(ruleset.getRuleByName("GuardLogStatementJavaUtil")); diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/QuickstartRulesetTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/QuickstartRulesetTest.java index fa3bb3f027..2daa2c1c39 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/QuickstartRulesetTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/QuickstartRulesetTest.java @@ -16,7 +16,7 @@ import org.junit.contrib.java.lang.system.SystemErrRule; import net.sourceforge.pmd.RuleSet; import net.sourceforge.pmd.RuleSetFactory; -import net.sourceforge.pmd.RuleSetFactory.RuleSetFactoryConfig; +import net.sourceforge.pmd.RuleSetParserConfig; import net.sourceforge.pmd.RuleSetNotFoundException; public class QuickstartRulesetTest { @@ -49,7 +49,7 @@ public class QuickstartRulesetTest { } }); - RuleSetFactory ruleSetFactory = new RuleSetFactoryConfig().enableCompatibility(false).createFactory(); + RuleSetFactory ruleSetFactory = new RuleSetParserConfig().enableCompatibility(false).createFactory(); RuleSet quickstart = ruleSetFactory.createRuleSet("rulesets/java/quickstart.xml"); Assert.assertFalse(quickstart.getRules().isEmpty()); } diff --git a/pmd-scala-modules/pmd-scala-common/src/test/java/net/sourceforge/pmd/lang/scala/ast/ScalaParsingHelper.java b/pmd-scala-modules/pmd-scala-common/src/test/java/net/sourceforge/pmd/lang/scala/ast/ScalaParsingHelper.java index 1f37f484c7..6c7ac28b46 100644 --- a/pmd-scala-modules/pmd-scala-common/src/test/java/net/sourceforge/pmd/lang/scala/ast/ScalaParsingHelper.java +++ b/pmd-scala-modules/pmd-scala-common/src/test/java/net/sourceforge/pmd/lang/scala/ast/ScalaParsingHelper.java @@ -13,8 +13,8 @@ import net.sourceforge.pmd.Report; import net.sourceforge.pmd.Rule; import net.sourceforge.pmd.RuleContext; import net.sourceforge.pmd.RuleSet; -import net.sourceforge.pmd.RuleSetFactory; import net.sourceforge.pmd.RuleSets; +import net.sourceforge.pmd.RulesetsFactoryUtils; import net.sourceforge.pmd.lang.ast.test.BaseParsingHelper; import net.sourceforge.pmd.lang.scala.ScalaLanguageModule; @@ -38,7 +38,7 @@ public final class ScalaParsingHelper extends BaseParsingHelper