Inspectopedia 2025.2 Help

Fallthrough in 'switch' statement

Reports 'fall-through' in a switch statement.

Fall-through occurs when a series of executable statements after a case label is not guaranteed to transfer control before the next case label. For example, this can happen if the branch is missing a break statement. In that case, control falls through to the statements after that switch label, even though the switch expression is not equal to the value of the fallen-through label. While occasionally intended, this construction is confusing and is often the result of a typo.

This inspection ignores any fall-through commented with a text matching the regex pattern (?i)falls?\s*thro?u.

There is a fix that adds a break to the branch that can fall through to the next branch.

Example:

switch(x) { case (4): if (condition) { System.out.println("3"); // no break here } else { break; } case (6): System.out.println("4"); }

After the quick-fix is applied:

switch(x) { case (4): if (condition) { System.out.println("3"); } else { break; } break; case (6): System.out.println("4"); }

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

fallthrough
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Java | Control flow issues

Suppressing Inspection

You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:

//noinspection fallthrough

More detailed instructions as well as other ways and options that you have can be found in the product documentation:

Inspection Details

By default bundled with:

IntelliJ IDEA 2025.2, Qodana for JVM 2025.2,

Last modified: 18 September 2025