BigDecimalEquals
BigDecimal#equals has surprising behavior: it also compares scale.

Severity
WARNING
Has Fix?
REQUIRES_HUMAN_ATTENTION

The problem

BigDecimal’s equals method compares the scale of the representation as well as the numeric value, which may not be expected.

java {.bad} BigDecimal a = new BigDecimal("1.0"); BigDecimal b = new BigDecimal("1.00"); a.equals(b); // false!

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("BigDecimalEquals") to the enclosing element.