Unreachable code in Java not detected

Hi,

I am surprised that the rule RSPEC-2583 does not detect my unreachable statement in Java. Is this a false-negative regarding the rule, or can the rule only detect unreachable code when boolean expressions are used?

Here is an example of the false-negative in my sonar cloud project.

The project shows the following example:

int V1 = 1;

if (V1 > 2) {
    V1 = 3;
}

Here the statement V1 = 3 cannot be reached, but the rule RSPEC-2583 in SonarCloud does not report this.

Thanks in advance for your help!

Hi Tim,

thank you for bringing up this issue, unfortunately, we are aware of this limitation in the symbolic execution engine (see SONARJAVA-4258) and for now, we won’t support such use cases.