Skip to content

[java] BigIntegerInstantiation: False negative with compile-time constant #4158

@adangel

Description

@adangel

Affects PMD 7.0.0

Besides, I found the rule BigIntegerInstantiation also has similar problem. Please read the code example below:

import java.math.BigInteger;
public class Foo {
  final String str = "1";
  BigInteger b = new BigInteger(str);  // should report a warning at this line, but not
}

PMD should have reported a warning at line 4, because there is a BigInteger defintion same with predefined instances. So, this is a false negative.

Originally posted by @Belle-PL in #3847 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-negativePMD doesn't flag a problematic piece of code

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions