added UnusedPrivateMethodRule

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@454 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2002-07-19 21:08:42 +00:00
parent 3010dc3022
commit 774d126911

View File

@ -161,13 +161,10 @@ public class UnusedPrivateMethodRule extends AbstractRule {
String img = (nodeImage.indexOf('.') == -1) ? nodeImage : nodeImage.substring(nodeImage.indexOf('.') +1, nodeImage.length());
for (Iterator i = privateMethodNodes.iterator(); i.hasNext();) {
ASTMethodDeclarator methodNode = (ASTMethodDeclarator)i.next();
// is the name the same?
if (methodNode.getImage().equals(img)) {
// is the number of params the same?
if (methodNode.getParameterCount() == args) {
// should check param types here, this misses some unused methods
i.remove();
}
// are name and number of parameters the same?
if (methodNode.getImage().equals(img) && methodNode.getParameterCount() == args) {
// should check parameter types here, this misses some unused methods
i.remove();
}
}
}