Skip to content

[java] AvoidDecimalLiteralsInBigDecimalConstructor FP with PMD 6.30.0 #3080

@testation21

Description

@testation21

Affects PMD Version: 6.30.0

Rule: AvoidDecimalLiteralsInBigDecimalConstructor
https://docs.pmd-code.org/latest/pmd_rules_java_errorprone.html#avoiddecimalliteralsinbigdecimalconstructor

Description:
When call toString() method in BigDecimalConstructor, pmd shows alarms which are False Positives I think.
Please, check this case.

Thank you.

Code Sample demonstrating the issue:

import java.math.BigDecimal;
class TestAvoidDecimalLiteralsInBigDecimalConstructor{
        public static void main(String[] args){
                BigDecimal d = new BigDecimal(Double.toString(0.1));
        }
}

Expected outcome:
Don't show any alarms.

Running PMD through: [CLI]

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-positivePMD flags a piece of code that is not problematic

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions