Labeled switch rule has redundant code block
Reports labeled rules of switch
statements or switch
expressions that have a redundant code block.
Example:
String s = switch (n) {
case 1 -> { yield Integer.toString(n); }
default -> "default";
};
After the quick-fix is applied:
String s = switch (n) {
case 1 -> Integer.toString(n);
default -> "default";
};
This inspection only reports if the language level of the project or module is 14 or higher.
New in 2019.1
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |
Last modified: 13 July 2023