Consider the following example:
void foo(String s) {
switch (s) {
case "a" -> foo("bar");
case "b" -> {
if (s.isBlank()) foo(s);
}
default -> foo("baz");
}
}
Sonar warns on the opening curly brace of the "b"
case: “Remove this redundant block.” linking to rule java:S6205. However removing the curly braces results in non compiling code (“Syntax error, type annotations are illegal here”) and also still the Sonar warning is present.
SonarLint for Eclipse 7.4.0.46482
Eclipse IDE for Enterprise Java and Web Developers (includes Incubating components)
Version: 2022-03 (4.23.0)
Build id: 20220310-1457
openjdk version “17.0.3” 2022-04-19
OpenJDK Runtime Environment Temurin-17.0.3+7 (build 17.0.3+7)
OpenJDK 64-Bit Server VM Temurin-17.0.3+7 (build 17.0.3+7, mixed mode, sharing)