Affects PMD Version: 7.6.0
Rule: TooFewBranchesForASwitchStatement
Description:
The rule currently only checks Switch Statements, but should also check Switch Expressions.
Therefore, the rule should be renamed to TooFewBranchesForSwitch (remove the statement part)
Code Sample demonstrating the issue:
public class DumbSwitch {
public String foo(int i) {
return switch (i) { // violation expected here
case 0:
{
yield "I am a fish.";
}
};
}
}
Expected outcome:
PMD should report a violation at line ..., but doesn't. This is a false-negative.
Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
Affects PMD Version: 7.6.0
Rule: TooFewBranchesForASwitchStatement
Description:
The rule currently only checks Switch Statements, but should also check Switch Expressions.
Therefore, the rule should be renamed to TooFewBranchesForSwitch (remove the statement part)
Code Sample demonstrating the issue:
Expected outcome:
PMD should report a violation at line ..., but doesn't. This is a false-negative.
Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]