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

30 lines
1.4 KiB
HTML

<html>
<body>
Reports method calls whose result is ignored.
<p>For many methods, ignoring the result is perfectly
legitimate, but for some it is almost certainly an error. Examples of methods where ignoring
the result is likely an error include <code>java.io.inputStream.read()</code>,
which returns the number of bytes actually read, and any method on
<code>java.lang.String</code> or <code>java.math.BigInteger</code>. These methods do not produce side-effects and thus pointless
if their result is ignored.
</p>
<p>The calls to the following methods are inspected:</p>
<ul>
<li>Simple getters (which do nothing except return a field)</li>
<li>Methods specified in the settings of this inspection</li>
<li>Methods annotated with <code>org.jetbrains.annotations.Contract(pure=true)</code></li>
<li>Methods annotated with .*.<code>CheckReturnValue</code></li>
<li>Methods in a class or package annotated with <code>javax.annotation.CheckReturnValue</code></li>
<li>Optionally, all non-library methods</li>
</ul>
<p>Calls to methods annotated with Error Prone's or AssertJ's <code>@CanIgnoreReturnValue</code> annotation are not reported.
<!-- tooltip end -->
<p>
Use the inspection settings to specify the classes to check.
Methods are matched by name or name pattern using Java regular expression syntax.
For classes, use fully-qualified names. Each entry applies to both the class and all its inheritors.
<p>
</body>
</html>