Inspectopedia Help

Nested 'switch' statement

Reports nested switch statements or expressions.

Nested switch statements may result in extremely confusing code. These statements may be extracted to a separate method.

Example:

int res = switch (i) { case 0 -> 0; default -> switch (i) { case 100 -> 0; default -> i; }; };

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023