Skip to content

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

Closed

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)

Activity

  1. changed the title [-][java] BigIntegerInstantiation false negative with compile-time constant[/-] [+][java] BigIntegerInstantiation false-negative with compile-time constant[/+] on Oct 14, 2022
  2. added
    a:false-negative
    on Oct 14, 2022
  3. added this to the 6.53.0 milestone on Nov 17, 2022
  4. modified the milestones: 6.53.0, 6.54.0 on Dec 31, 2022
  5. removed this from the 6.54.0 milestone on Jan 19, 2023
  6. added
    needs:pmd7-revalidation
    and removed
    needs:pmd7-revalidation
    on Mar 17, 2024
  7. changed the title [-][java] BigIntegerInstantiation false-negative with compile-time constant[/-] [+][java] BigIntegerInstantiation: False negative with compile-time constant[/+] on Dec 28, 2025
  8. added this to the 7.20.0 milestone on Dec 28, 2025
  9. added a commit that references this issue on Dec 28, 2025
  10. added a commit that references this issue on Dec 28, 2025
    b5bf8fd
  11. added a commit that references this issue on Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-negative

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions