Files
Leonid Shalupov 40795fe787 IJI-2422: community/java: move resources under resources root
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
2025-02-05 04:43:28 +00:00

32 lines
1.4 KiB
HTML

<html>
<body>
Reports <code>throws</code> clauses with exceptions that are more generic than the
exceptions that the method actually throws.
<p><b>Example:</b></p>
<pre><code>
public void createFile() throws Exception { // warning: 'throws Exception' is too broad, masking exception 'IOException'
File file = new File("pathToFile");
file.createNewFile();
}
</code></pre>
<p>After the quick-fix is applied:</p>
<pre><code>
public void createFile() throws IOException {
File file = new File("pathToFile");
file.createNewFile();
}
</code></pre>
<!-- tooltip end -->
<p>Configure the inspection:</p>
<ul>
<li>Use the <b>Maximum number of hidden exceptions to warn</b> field to ignore exceptions, that hide a larger number of other exceptions than specified.</li>
<li>Use the <b>Only warn on RuntimeException, Exception, Error or Throwable</b> option to have this inspection warn only on the most generic
exceptions.</li>
<li>Use the <b>Ignore exceptions declared on methods overriding a library method</b> option to ignore overly broad <code>throws</code> clauses
in methods that override a library method.</li>
<li>Use the <b>Ignore exceptions which hide others but are themselves thrown</b> option to ignore any exceptions that hide other exceptions
but still may be thrown from the method body and thus
are technically not overly broad.</li>
</ul>
</body>
</html>