Bug fix: NPE in MoreThanOneLogger
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/4.2.x@6073 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
Fixed false positive in UnusedImports: javadoc comments are parsed to check @see and other tags
|
Fixed false positive in UnusedImports: javadoc comments are parsed to check @see and other tags
|
||||||
Fixed parsing bug: constant fields in annotation classes
|
Fixed parsing bug: constant fields in annotation classes
|
||||||
|
Bug fix: NPE in MoreThanOneLogger
|
||||||
|
|
||||||
April 11, 2008 - 4.2.1:
|
April 11, 2008 - 4.2.1:
|
||||||
|
|
||||||
|
@ -37,6 +37,17 @@ public class Foo {
|
|||||||
class Bar {
|
class Bar {
|
||||||
Logger log2;
|
Logger log2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
]]></code>
|
||||||
|
</test-code>
|
||||||
|
<test-code>
|
||||||
|
<description><![CDATA[
|
||||||
|
ok, fixing NPE bug
|
||||||
|
]]></description>
|
||||||
|
<expected-problems>0</expected-problems>
|
||||||
|
<code><![CDATA[
|
||||||
|
public @interface Foo {
|
||||||
|
String FOO = "foo";
|
||||||
}
|
}
|
||||||
]]></code>
|
]]></code>
|
||||||
</test-code>
|
</test-code>
|
||||||
|
@ -3,6 +3,7 @@ package net.sourceforge.pmd.rules;
|
|||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
|
|
||||||
import net.sourceforge.pmd.AbstractRule;
|
import net.sourceforge.pmd.AbstractRule;
|
||||||
|
import net.sourceforge.pmd.ast.ASTAnnotationTypeDeclaration;
|
||||||
import net.sourceforge.pmd.ast.ASTClassOrInterfaceDeclaration;
|
import net.sourceforge.pmd.ast.ASTClassOrInterfaceDeclaration;
|
||||||
import net.sourceforge.pmd.ast.ASTClassOrInterfaceType;
|
import net.sourceforge.pmd.ast.ASTClassOrInterfaceType;
|
||||||
import net.sourceforge.pmd.ast.ASTEnumDeclaration;
|
import net.sourceforge.pmd.ast.ASTEnumDeclaration;
|
||||||
@ -44,6 +45,10 @@ public class MoreThanOneLogger extends AbstractRule {
|
|||||||
return init (node, data);
|
return init (node, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object visit(ASTAnnotationTypeDeclaration node, Object data) {
|
||||||
|
return init (node, data);
|
||||||
|
}
|
||||||
|
|
||||||
private Object init(SimpleJavaNode node, Object data) {
|
private Object init(SimpleJavaNode node, Object data) {
|
||||||
stack.push(count);
|
stack.push(count);
|
||||||
count = NumericConstants.ZERO;
|
count = NumericConstants.ZERO;
|
||||||
|
Reference in New Issue
Block a user