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.
Locating this inspection
- 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.
RedundantThrows- Via Settings dialog
Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.
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 inspection.
Inspection options
Here you can find the description of settings available for the Redundant 'throws' clause inspection, and the reference of their default values.
- Ignore exceptions thrown by entry point methods
Not selected
Inspection Details | |
---|---|
By default bundled with: | |
Can be installed with plugin: | Java, 243.23126 |