Multi-catch can be split into separate catch blocks
Reports multi-catch
sections and suggests splitting them into separate catch
blocks.
Example:
try {
int i = getIndex();
} catch (NullPointerException|IndexOutOfBoundsException e) {
e.printStackTrace();
}
After the quick-fix is applied:
try {
int i = getIndex();
} catch (NullPointerException e) {
e.printStackTrace();
} catch (IndexOutOfBoundsException e) {
e.printStackTrace();
}
Multi-catch
appeared in Java 7. This inspection can help to downgrade for backward compatibility with earlier Java versions.
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |
Last modified: 13 July 2023