forked from phoedos/pmd
False positives + bug fix
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4842 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -35,6 +35,18 @@ public class Foo {
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
Pass, BigDecimal(i - 1)
|
||||
]]></description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
int i = 42;
|
||||
BigDecimal b = new BigDecimal(i - 1);
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
Pass, BigInteger("10") and BigDecimal in 1.4 mode
|
||||
]]></description>
|
||||
<expected-problems>0</expected-problems>
|
||||
|
@ -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) == '"')) {
|
||||
|
Reference in New Issue
Block a user