Java
Enhanced 'switch'
Info
New
Last modified: 03 December 2024 Reports enhanced switch
statements and expressions. Suggests replacing them with regular switch
statements.
Example:
boolean even = switch (condition) {
case 1, 3, 5, 7, 9 -> false;
default -> true;
};
After the quick-fix is applied:
boolean even;
switch (condition) {
case 1:
case 3:
case 5:
case 7:
case 9:
even = false;
break;
default:
even = true;
break;
}
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
EnhancedSwitchBackwardMigration
Enhanced switch
appeared in Java 14. This inspection can help to downgrade for backward compatibility with earlier Java versions.
New in 2019.1
Inspection Details | |
---|---|
By default bundled with: | |
Can be installed with plugin: | Java, 243.23126 |
Thanks for your feedback!
Was this page helpful?