Why do you believe it’s a false-positive/false-negative?
because there is no way satisfy the rule without changing behavior
Are you using
SonarQube - Data Center Edition v2026.1.2 (121356)
SonarQube for IDE - SonarLint for Eclipse 12.2.0.84672
in connected mode with above server
How can we reproduce the problem
public String getString() throws IOException {
try {
return "";
} catch (Exception e) {
switch (e.getCause()) { // issue created on this switch word: "Use "switch" expression to return the value from method."
case IOException ioException -> throw ioException;
case RuntimeException exception -> throw exception;
default -> throw new IllegalStateException("Unexpected error was thrown from getString", e);
}
}
}