diff --git a/pmd/src/net/sourceforge/pmd/rules/ExcessivePublicCountRule.java b/pmd/src/net/sourceforge/pmd/rules/ExcessivePublicCountRule.java index dc70f77b51..926c98f338 100644 --- a/pmd/src/net/sourceforge/pmd/rules/ExcessivePublicCountRule.java +++ b/pmd/src/net/sourceforge/pmd/rules/ExcessivePublicCountRule.java @@ -33,10 +33,15 @@ public class ExcessivePublicCountRule extends ExcessiveNodeCountRule { return this.getTallyOnAccessType((AccessNode)node.jjtGetParent()); } /** - * Method counts ONLY public class attributes + * Method counts ONLY public class attributes which are not PUBLIC and + * static- these usually represent constants.... */ public Object visit(ASTFieldDeclaration node, Object data) { - return this.getTallyOnAccessType(node); + if(node.isFinal() && node.isStatic()){ + return new Integer(0); + }else{ + return this.getTallyOnAccessType(node); + } } /** * Method counts a node if it is public