modified to use AccessNode

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@122 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2002-06-28 17:21:35 +00:00
parent 80c17dcd21
commit 38b8a57e62

View File

@ -62,7 +62,11 @@ public class UnusedPrivateInstanceVariableRule extends AbstractRule implements R
}
//System.out.println("ASTVariableDeclaratorId.getImage() = " + node.getImage() + "; " + node.getBeginLine());
SimpleNode grandparent = (SimpleNode)node.jjtGetParent().jjtGetParent();
if (!(grandparent instanceof ASTFieldDeclaration) || grandparent.getImage().indexOf("private") == -1 || grandparent.getImage().indexOf("static") != -1) {
if (!(grandparent instanceof ASTFieldDeclaration)) {
return super.visit(node, data);
}
AccessNode grandparentAccessNode = (AccessNode)grandparent;
if (grandparentAccessNode.isPublic() || grandparentAccessNode.isStatic()) {
return super.visit(node, data);
}
Namespace group = (Namespace)nameSpaces.peek();