forked from phoedos/pmd
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:
parent
411cf2826f
commit
713dc2a9a5
@ -2,6 +2,7 @@
|
||||
|
||||
Fixed false positive in UnusedImports: javadoc comments are parsed to check @see and other tags
|
||||
Fixed parsing bug: constant fields in annotation classes
|
||||
Bug fix: NPE in MoreThanOneLogger
|
||||
|
||||
April 11, 2008 - 4.2.1:
|
||||
|
||||
|
@ -37,6 +37,17 @@ public class Foo {
|
||||
class Bar {
|
||||
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>
|
||||
</test-code>
|
||||
|
@ -3,6 +3,7 @@ package net.sourceforge.pmd.rules;
|
||||
import java.util.Stack;
|
||||
|
||||
import net.sourceforge.pmd.AbstractRule;
|
||||
import net.sourceforge.pmd.ast.ASTAnnotationTypeDeclaration;
|
||||
import net.sourceforge.pmd.ast.ASTClassOrInterfaceDeclaration;
|
||||
import net.sourceforge.pmd.ast.ASTClassOrInterfaceType;
|
||||
import net.sourceforge.pmd.ast.ASTEnumDeclaration;
|
||||
@ -44,6 +45,10 @@ public class MoreThanOneLogger extends AbstractRule {
|
||||
return init (node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTAnnotationTypeDeclaration node, Object data) {
|
||||
return init (node, data);
|
||||
}
|
||||
|
||||
private Object init(SimpleJavaNode node, Object data) {
|
||||
stack.push(count);
|
||||
count = NumericConstants.ZERO;
|
||||
|
Loading…
x
Reference in New Issue
Block a user