Prohibited exception thrown
Reports throw
statements that throw an inappropriate exception. For example an exception can be inappropriate because it is overly generic, such as java.lang.Exception
or java.io.IOException
.
Example:
void setup(Mode mode) {
if (mode == null)
throw new RuntimeException("Problem during setup"); // warning: Prohibited exception 'RuntimeException' thrown
...
}
Use the Prohibited exceptions list to specify which exceptions should be reported.
Inspection options
Option | Type | Default |
---|---|---|
Prohibited exceptions | StringList | [java.lang.Throwable, java.lang.Exception, java.lang.Error, java.lang.RuntimeException, java.lang.NullPointerException, java.lang.ClassCastException, java.lang.ArrayIndexOutOfBoundsException] |
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |
Last modified: 13 July 2023