Update on the rule, but still not working...

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5782 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Romain Pelisse
2008-02-15 19:11:31 +00:00
parent c17da43741
commit 310141fa71

View File

@ -12,6 +12,7 @@ import net.sourceforge.pmd.AbstractJavaRule;
import net.sourceforge.pmd.PropertyDescriptor;
import net.sourceforge.pmd.RuleContext;
import net.sourceforge.pmd.ast.ASTClassOrInterfaceType;
import net.sourceforge.pmd.ast.ASTCompilationUnit;
import net.sourceforge.pmd.ast.ASTImportDeclaration;
import net.sourceforge.pmd.ast.SimpleNode;
import net.sourceforge.pmd.properties.StringProperty;
@ -61,22 +62,22 @@ public class GenericClassCounterRule extends AbstractJavaRule {
"Defines how many occurences are legal",new String(),4.0f);
private List<Pattern> namesMatch;
private List<Pattern> typesMatch;
private List<SimpleNode> matches;
private List<String> simpleClassname;
private List<Pattern> namesMatch = new ArrayList<Pattern>(0);
private List<Pattern> typesMatch = new ArrayList<Pattern>(0);
private List<SimpleNode> matches = new ArrayList<SimpleNode>(0);
private List<String> simpleClassname = new ArrayList<String>(0);
private String operand;
private int threshold;
private static String COUNTER_LABEL;
/**
* Default empty constructor
*/
public GenericClassCounterRule() {
super();
init();
}
private List<String> arrayAsList(String[] array) {
@ -108,6 +109,12 @@ public class GenericClassCounterRule extends AbstractJavaRule {
super.start(ctx);
}
@Override
public Object visit(ASTCompilationUnit node, Object data) {
init();
return super.visit(node,data);
}
@Override
public Object visit(ASTImportDeclaration node, Object data) {
// Is there any imported types that match ?