diff --git a/pmd/regress/test/net/sourceforge/pmd/rules/xml/BigIntegerInstantiation.xml b/pmd/regress/test/net/sourceforge/pmd/rules/xml/BigIntegerInstantiation.xml index f116cd31a0..bfae4d3258 100644 --- a/pmd/regress/test/net/sourceforge/pmd/rules/xml/BigIntegerInstantiation.xml +++ b/pmd/regress/test/net/sourceforge/pmd/rules/xml/BigIntegerInstantiation.xml @@ -35,6 +35,18 @@ public class Foo { + 0 + + + + 0 diff --git a/pmd/src/net/sourceforge/pmd/rules/basic/BigIntegerInstantiation.java b/pmd/src/net/sourceforge/pmd/rules/basic/BigIntegerInstantiation.java index 1ab554a503..463d981a63 100644 --- a/pmd/src/net/sourceforge/pmd/rules/basic/BigIntegerInstantiation.java +++ b/pmd/src/net/sourceforge/pmd/rules/basic/BigIntegerInstantiation.java @@ -32,6 +32,9 @@ public class BigIntegerInstantiation extends AbstractRule { ASTArguments args = (ASTArguments) node.getFirstChildOfType(ASTArguments.class); if (args.getArgumentCount() == 1) { ASTLiteral literal = (ASTLiteral) node.getFirstChildOfType(ASTLiteral.class); + if (literal == null || literal.jjtGetParent().jjtGetParent().jjtGetParent().jjtGetParent().jjtGetParent() != args) { + return super.visit(node, data); + } img = literal.getImage(); if ((img.length() > 2 && img.charAt(0) == '"')) {