A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/5287 below:

[java] TooFewBranchesForSwitch false-positive with switch using list of case constants · Issue #5287 · pmd/pmd · GitHub

Affects PMD Version:
7.7.0

Rule:
TooFewBranchesForSwitch.

Description:
Having multiple labels in a single case should be considered the same as multiple cases. So no TooFewBranchesForSwitch should be triggered for the code below:

Code Sample demonstrating the issue:

return switch (someEnumValue) {
    case A, B, C -> 1;
    default -> 0;
};

Expected outcome:
No violation.

Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
Gradle


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4