Bug not detected RSPEC-2123

Hi Team,

The expected SonarQube bug appears not to be caught in the code below, even though it’s caught in a very similar code as seen in the screenshot. Any thoughts?

class UselessIncrementBug {

    public void showBug() {
        int i = 0;
        int j = 0;
        int a = 0;

        a = i++;

        System.out.println("The value of a is: " + a); 
        System.out.println("The value of j is: " + j++);
    }
    public static void main(String[] args) {
        UselessIncrementBug bug = new UselessIncrementBug();
        bug.showBug();
    }
}

Sonarqube version 25.5
Lang: Java
SonarScanner version: 5.0.1.3006

Screenshot of code scan results

1 Like

Hello, thanks for the multiple reports.

I have created this ticket to group them up and keep track of them. We will investigate them as soon as we have the capacity for it!

Have a good day :slight_smile: