diff --git a/pmd/src/net/sourceforge/pmd/rules/UnusedFormalParameterRule.java b/pmd/src/net/sourceforge/pmd/rules/UnusedFormalParameterRule.java index 291bb7ce9e..f2d0431f97 100644 --- a/pmd/src/net/sourceforge/pmd/rules/UnusedFormalParameterRule.java +++ b/pmd/src/net/sourceforge/pmd/rules/UnusedFormalParameterRule.java @@ -10,6 +10,7 @@ import net.sourceforge.pmd.ast.ASTBlock; import net.sourceforge.pmd.RuleContext; import java.text.MessageFormat; import net.sourceforge.pmd.ast.ASTVariableDeclaratorId; +import net.sourceforge.pmd.ast.ASTPrimaryPrefix; public class UnusedFormalParameterRule extends AbstractRule { @@ -30,12 +31,18 @@ public class UnusedFormalParameterRule extends AbstractRule { int index = 0; if (startNode instanceof ASTName) { String nodeImage = ((ASTName)startNode).getImage(); + //check to see if there is a "." in the image which indicates a method call on this variable name + int index2 = nodeImage.indexOf('.'); + if (index2 != -1) { + nodeImage = nodeImage.substring(0, index2); //set the node Image to the prefix + } if (paramNames.contains(nodeImage)) { paramNames.remove(nodeImage); //the name is used so let's remove it from the list } } else if (startNode.jjtGetNumChildren() > 0) { - for (int i=0; i