Back to Intellij Community

GroovyFallthrough

plugins/groovy/groovy-psi/resources/inspectionDescriptions/GroovyFallthrough.html

2025.3-rc-2365 B
Original Source

Reports fallthrough in switch statements. While occasionally useful, fallthrough is often unintended, and may lead to surprising bugs.

Example:

switch(n) {
  case 1:
    print 1
  case 2: // "case 1" fallthrough to "case 2". Statements from "case 2" will be executed immediately after "case 1".
    print 2
    break
  default:
    print "Default"
}