Back to Intellij Community

RedundantLabeledSwitchRuleCodeBlock

java/java-impl/resources/inspectionDescriptions/RedundantLabeledSwitchRuleCodeBlock.html

2025.3-rc-2368 B
Original Source

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";
  };

New in 2019.1