Back to Intellij Community

EnumSwitchStatementWhichMissesCases

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

2025.3-rc-2538 B
Original Source

Reports switch statements over enumerated types that are not exhaustive.

Example:

enum AlphaBetaGamma {
    A, B, C;

    void x(AlphaBetaGamma e) {
      switch (e) {

      }
    }
  }

After the quick-fix is applied:

enum AlphaBetaGamma {
    A, B, C;

    void x(AlphaBetaGamma e) {
      switch (e) {
        case A -> {}
        case B -> {}
        case C -> {}
      }
    }
  }

Use the Ignore switch statements with a default branch option to ignore switch statements that have a default branch.