Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PMD xpath rule to warn about the use of equals() on BigDecimal

Tags:

pmd

Could someone suggest a PMD xpath rule to warn that calling the equals() method of java.math.BigDecimal will check for both value and scale which usually (unless for some engineering type apps) might be a mistake. Since 1.0 not equals 1.00, one should use compareTo.

like image 220
Ben Avatar asked Nov 14 '22 09:11

Ben


1 Answers

It looks rather complicated with PMD but FindBugs already has a rule for this.

like image 148
palacsint Avatar answered Jan 12 '23 22:01

palacsint