False Negative for rule RSPEC-2184

Hi, Looking at those snippets labelled image 1 and image 2 below. By referencing RSPEC-2184, image 1 correctly shows bugs in line 3, 8 and 12. However, in image 2, which is a variant from the original code, the bug is not flagged in lines 3,4 or 9.

The rule is that mathematical operations performed on integers and then assigned to a long, double, or float exhibit inconsistent behaviour. From the images below it can be seen that this rule has been violated in both snippets.

Sonarqube version: 9.9.0.65466
SonarScanner version: 5.0.1.3006
SonarQube Community Edition
Related language: Java


Image 1


Image 2

Hey there.

Please take a look at this post on reporting false-positives.

You’ll need to provide a text-based snippet of code, and make sure the issue can be reproduced on the latest version of SonarQube’s Community Build.

Only the latest version of SonarQube Community Build is considered active, so you’ll need to upgrade and see if the false-negative can still be produced!

Your upgrade path is:

9.9.0 → 24.12 → 25.5

You may find these resources helpful: