Correct NPE by restoring code which initializes the method/constructor Lists.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@6280 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
1 parent
2aaa9cd05c
commit
b664dc2846
1 file changed
+11
-5
@@ -1,7 +1,9 @@
|
||||
package net.sourceforge.pmd.util.designer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit;
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTConstructorDeclaration;
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration;
|
||||
import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule;
|
||||
@@ -12,15 +14,15 @@ public class DFAGraphRule extends AbstractJavaRule {
|
||||
private List<ASTConstructorDeclaration> constructors;
|
||||
|
||||
public DFAGraphRule() {
|
||||
super.setUsesDFA();
|
||||
super.setUsesDFA();
|
||||
}
|
||||
|
||||
public List<ASTMethodDeclaration> getMethods() {
|
||||
return this.methods;
|
||||
return this.methods;
|
||||
}
|
||||
|
||||
public List<ASTConstructorDeclaration> getConstructors() {
|
||||
return this.constructors;
|
||||
return this.constructors;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -35,6 +37,10 @@ public class DFAGraphRule extends AbstractJavaRule {
|
||||
return super.visit(node, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object visit(ASTCompilationUnit acu, Object data) {
|
||||
methods = new ArrayList<ASTMethodDeclaration>();
|
||||
constructors = new ArrayList<ASTConstructorDeclaration>();
|
||||
return super.visit(acu, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user