Files
openide/java/java-impl/resources/inspectionDescriptions/RedundantThrows.html
2025-02-05 04:43:28 +00:00

28 lines
1.3 KiB
HTML

<html>
<body>
Reports exceptions that are declared in a method's signature but never thrown by the method itself or its implementations and overriding methods.
<p>The inspection ignores methods related to serialization, for example the methods <code>readObject()</code> and <code>writeObject()</code>.</p>
<p><b>Example:</b></p>
<pre><code>
void method() throws InterruptedException {
System.out.println();
}
</code></pre>
<p>The quick-fix removes unnecessary exceptions from the declaration and normalizes redundant <code>try</code>-<code>catch</code> statements:</p>
<pre><code>
void method() {
System.out.println();
}
</code></pre>
<p>
<b>Note:</b> Some exceptions may not be reported during in-editor highlighting for performance reasons.
To see all results, run the inspection by selecting <b>Code | Inspect Code</b> or <b>Code | Analyze Code | Run Inspection by Name</b> from the main menu.
</p>
<!-- tooltip end -->
<p>Use the <b>Ignore exceptions thrown by entry point methods</b> option to not report exceptions thrown by
for example <code>main()</code> methods.
Entry point methods can be configured in the settings of the
<a href="settings://Errors?Unused%20Declaration%20entry%20point">Java | Declaration redundancy | Unused declaration</a> inspection.
<br><br></p>
</body>
</html>