mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 21:01:48 +07:00
32 lines
1.4 KiB
HTML
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> |