Hello everybody,
I just happened to notice a bug when using SonarLint in IntelliJ. Given the following Java-Code, Sonar Lint suggests to merge the two if statements:
if (a || b) {
if (c) {
// code
}
}
However, the result of this action changes the semantics of the if statement:
if (a || b && (c)) {
// code
}
When merging the two if statements with native IntelliJ Feature “merge nested if statements” the result is correct:
if ((a || b) && c) {
// code
}
My expectation would be, that the SonarLint Plugin would behave the same way (or even use the same functions under the hood) as IntelliJ when merging the if statements to not change the semantics and introduce a new bug.
SonarLint PluginVersion: 10.3.0.77475
IntelliJ Version: Build #IU-233.14015.106
Platform: MacOS