A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/4886 below:

False Positive with Java 17 and BigDecimal.TWO · Issue #4886 · pmd/pmd · GitHub

Affects PMD Version:

7.0.0

Rule:

https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_performance.html#bigintegerinstantiation

Description:

The rule fails on Java 17.
BigDecimal.TWO was introduced in Java 19.

Code Sample demonstrating the issue:

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
enum Ratio {
  TWO("One to Two", "1:2", new BigDecimal("2"));

    private final String title;
    private final String calculation;
    private final BigDecimal factor;
}

Expected outcome:

PMD reports a violation, but that's wrong. That's a false positive.

Running PMD through: [Gradle]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4