Fix bug 1928009 - Error using migration ruleset in PMD 4.2

AbstractRuleChainVisitor changed an 'if' to a 'while' to ensure all RuleReferences were followed to find the real underlying Rule.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/4.2.x@5942 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Ryan Gustafson 2008-03-28 22:45:43 +00:00
parent e84d41bebb
commit 4d127404d3
3 changed files with 10 additions and 5 deletions

View File

@ -1,6 +1,7 @@
???? - 4.2.1:
'41' and '42' shortcuts for rulesets added
Fixed bug 1928009 - Error using migration ruleset in PMD 4.2
March 25, 2008 - 4.2:

View File

@ -72,6 +72,10 @@ Rules to check PMD itself
<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
<!-- Unused code End-->
<rule ref="rulesets/migrating.xml"/>
<!-- Specifically reference via other referencing RuleSets to test Reference to Reference -->
<rule ref="rulesets/migrating_to_13.xml"/>
<rule ref="rulesets/migrating_to_14.xml"/>
<rule ref="rulesets/migrating_to_15.xml"/>
<rule ref="rulesets/migrating_to_junit4.xml"/>
</ruleset>

View File

@ -57,10 +57,10 @@ public abstract class AbstractRuleChainVisitor implements RuleChainVisitor {
for (int j = 0; j < nodeNames.size(); j++) {
List<SimpleNode> nodes = nodeNameToNodes.get(nodeNames.get(j));
for (SimpleNode node: nodes) {
// Visit with underlying Rule, not the RuleReference
if (rule instanceof RuleReference) {
rule = ((RuleReference)rule).getRule();
}
// Visit with underlying Rule, not the RuleReference
while (rule instanceof RuleReference) {
rule = ((RuleReference)rule).getRule();
}
visit(rule, node, ctx);
}
visits += nodes.size();