oops, NPE in previous commit...
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@6748 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
1 parent
b5ce3f154b
commit
b6a7e7da76
2 files changed
+19
-1
No files matched your search
@@ -163,6 +163,20 @@ public enum EnumTest {
|
||||
public static void main(String[] args) {
|
||||
System.out.println(EnumTest.A);
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
NPE in incorrect implementation...
|
||||
]]></description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
public Foo() { }
|
||||
public void doSomething() { }
|
||||
public static void main(String args[]) { }
|
||||
;
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
@@ -26,7 +26,11 @@ public class UseSingletonRule extends AbstractJavaRule {
|
||||
int methodCount = 0;
|
||||
boolean isOK = false;
|
||||
while (i > 0) {
|
||||
Node n = decl.jjtGetChild(--i).jjtGetChild(0);
|
||||
Node n = decl.jjtGetChild(--i);
|
||||
if (n.jjtGetNumChildren() != 1) {
|
||||
break;
|
||||
}
|
||||
n = n.jjtGetChild(0);
|
||||
if (n instanceof ASTFieldDeclaration) {
|
||||
if (!((ASTFieldDeclaration) n).isStatic()) {
|
||||
isOK = true;
|
||||
|
||||
Reference in new issue
Block a user