'switch' statement without 'default' branch
Reports switch
statements that do not contain default
labels.
Adding the default
label guarantees that all possible scenarios are covered, and it becomes easier to make assumptions about the current state of the program.
Note that by default, the inspection does not report switch
statements if all cases for enums or sealed
classes are covered. Use the Ignore exhaustive switch statements option if you want to change this behavior.
Inspection options
Option | Type | Default |
---|---|---|
Ignore exhaustive switch statements | Checkbox | true |
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |
Last modified: 13 July 2023