From b7caf2ff762fea4c908b31a2337b04af4ff2f770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 16 Oct 2017 13:22:50 +0200 Subject: [PATCH] Remove rule factory singleton --- .../src/main/java/net/sourceforge/pmd/RuleSetFactory.java | 4 ++-- .../main/java/net/sourceforge/pmd/ruledef/RuleFactory.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) 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 f356339f22..8ce6215de2 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactory.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactory.java @@ -526,7 +526,7 @@ public class RuleSetFactory { && !isRuleName(ruleElement, ruleSetReferenceId.getRuleName())) { return; } - Rule rule = RuleFactory.INSTANCE.buildRule(ruleElement); + Rule rule = new RuleFactory().buildRule(ruleElement); rule.setRuleSetName(ruleSetBuilder.getName()); if (StringUtils.isNotBlank(ruleSetReferenceId.getRuleName()) @@ -607,7 +607,7 @@ public class RuleSetFactory { RuleSetReference ruleSetReference = new RuleSetReference(otherRuleSetReferenceId.getRuleSetFileName(), false); - RuleReference ruleReference = RuleFactory.INSTANCE.decorateRule(referencedRule, ruleElement); + RuleReference ruleReference = new RuleFactory().decorateRule(referencedRule, ruleElement); ruleReference.setRuleSetReference(ruleSetReference); diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/ruledef/RuleFactory.java b/pmd-core/src/main/java/net/sourceforge/pmd/ruledef/RuleFactory.java index 8e10f226d4..810258718e 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/ruledef/RuleFactory.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/ruledef/RuleFactory.java @@ -35,8 +35,7 @@ import net.sourceforge.pmd.properties.PropertyDescriptorUtil; */ public class RuleFactory { - public static final RuleFactory INSTANCE = new RuleFactory(); - + private static final String DEPRECATED = "deprecated"; private static final String NAME = "name"; private static final String MESSAGE = "message"; @@ -52,7 +51,8 @@ public class RuleFactory { private static final String CLASS = "class"; - private RuleFactory() { + /** Create a new rule factory. */ + public RuleFactory() { }