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

By default bundled with:

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin:

Java, 241.16690

Last modified: 29 April 2024