Inspectopedia Help

Enum 'switch' statement that misses case

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.

Inspection options

Option

Type

Default

Ignore switch statements with a default branch

Checkbox

true

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023