Redundant 'throws' clause
Reports exceptions that are declared in a method's signature but never thrown by the method itself or its implementations and overriding methods.
The inspection ignores methods related to serialization, for example the methods readObject()
and writeObject()
.
Example:
The quick-fix removes unnecessary exceptions from the declaration and normalizes redundant try
-catch
statements:
Note: Some exceptions may not be reported during in-editor highlighting for performance reasons. To see all results, run the inspection by selecting Code | Inspect Code or Code | Analyze Code | Run Inspection by Name from the main menu.
Use the Ignore exceptions thrown by entry point methods option to not report exceptions thrown by for example main()
methods. Entry point methods can be configured in the settings of the Java | Declaration redundancy | Unused declaration inspection.
Inspection options
Option | Type | Default |
---|---|---|
Ignore exceptions thrown by entry point methods | Checkbox | false |
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |