FallThrough
Switch case may fall through

Severity
WARNING

Alternate names: fallthrough

The problem

The Google Java Style Guide ยง4.8.4.2 requires that within a switch block, each statement group either terminates abruptly (with a break, continue, return or throw statement), or is marked with a comment to indicate that execution will or might continue into the next statement group. This special comment is not required in the last statement group of the switch block.

Example:

switch (input) {
  case 1:
  case 2:
    prepareOneOrTwo();
    // fall through
  case 3:
    handleOneTwoOrThree();
    break;
  default:
    handleLargeNumber(input);
}

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("FallThrough") to the enclosing element.