Affects PMD Version: 6.29.0
Rule: SwitchStmtsShouldHaveDefault
Description:
If a switch-case over a enum is used inside the enum itself, PMD wrongly requests to add a default case, even though the switch statement is exhaustive. The switch is over this
:
Code Sample demonstrating the issue:
package myPackage; public enum GradeSystem { SysA, SysB; public boolean isValid() { switch (this) { // false-positive case SysA: case SysB: return true; } return false; } }
Result:myPackage/GradeSystem.java:8: Switch statements should have a default label
Expected outcome:
Running PMD through: CLI
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