Hi,
I’m using version 6.7.5 of SonarQube.
Rule “Switch cases should end with an unconditional “break” statement” raises an error on following piece of code:
switch (in) {
case 0:
return 0;
case 1: // SonarQube violation here:
// "End this switch case with an unconditional break, return or throw statement."
try {
return doIt();
} finally {
}
default:
return 99;
}
For me, in case 1, I always return or throw an exception, even though there’s a finally statement.
Do I miss something or is this a false positive?
Thanks a lot.
Regards,
Nicolas