Back to Intellij Community

BreakStatementWithLabel

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

2025.3-rc-2320 B
Original Source

Reports break statements with labels.

Labeled break statements complicate refactoring and can be confusing.

Example:

void handle(List<String> strs) {
    outer:
    for (String s: strs) {
      for (char ch : s.toCharArray()) {
        if ('s' == ch) break outer;
        handleChar(ch);
      }
    }
  }