If your question is about SonarQube for IDE in the IntelliJ Platform, VS Code, Visual Studio, or Eclipse, please post it in that sub-category.
Otherwise, please provide:
- Operating system: Windows
- IDE name and flavor/env: IntelliJ Ultimate
And a thorough description of the problem / question:
When switching over enums with 2 or less values S1301 will fire and tell you to use if statements. This is a false positive because you want switch exhaustion over enums.
enum Something {
ONE, TWO
}
var s = ONE;
switch (s) { <-- S1301 here
case ONE -> ...;
case TWO -> ...;
}