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

31 lines
1.1 KiB
HTML

<html>
<body>
Reports <code>if</code> statements that can be simplified to a single assignment,
<code>return</code>, or <code>assert</code> statement.
<p>Example:</p>
<pre><code>
if (foo()) {
return true;
} else {
return false;
}
</code></pre>
<p>After the quick-fix is applied:</p>
<pre><code>
return foo();
</code></pre>
<!-- tooltip end -->
<p>Configure the inspection:</p>
<p>Use the <b>Ignore chained 'if' statements </b> option if you want to hide a warning for chained <code>if</code> statements.</p>
<p>For example, in the following code the warning will be hidden, but the quick-fix will still be available:</p>
<pre><code>
if (condition1) return true;
if (condition2) return false;
return true;
</code></pre>
<p>Note that replacing <code>if (isTrue()) assert false;</code> with <code>assert isTrue();</code> may change the program semantics
when asserts are disabled if condition has side effects.
Use the <b>Ignore 'if' statements with trivial 'assert'</b> option if you want to hide a warning for <code>if</code> statements
containing only <code>assert</code> statement in their bodies.</p>
</body>
</html>