SONARJAVA-6874 S9351: Fix FPs on null checks and normalized scales - #6057
Conversation
Code Review ✅ Approved 3 resolved / 3 findingsFixes false positives in S9351 by ignoring ✅ 3 resolved✅ Bug: SET_SCALE uses ofTypes, so subclass receivers keep the FP
✅ Bug: Null-literal exception not applied to instance equals(null)
✅ Quality: S9351 Exceptions section omits the two new exemptions
Implementation Status ✅ 4 of 4 objectives covered✅ RC-289 - 2 of 2 objectives coveredThis PR covers both objectives by avoiding false positives on null checks in static equality helpers and scale-normalized BigDecimal equals calls. ✅ 2 covered here
✅ SONARJAVA-6874 - 2 of 2 objectives coveredThis PR covers both objectives by skipping S9351 reports on static equality helpers with null arguments and on equals comparisons where both operands are setScale calls with identical constant scales. ✅ 2 covered here
OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
|




Fixes SONARJAVA-6874.
Summary
Objects.equalsand GuavaObjects.equalcalls when either operand is a null literal.BigDecimal.setScalecalls with the same compile-time scale.Test
mvn -pl java-checks -Dtest=BigDecimalEqualsCheckTest test