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

23 lines
751 B
HTML

<html>
<body>
Reports usages of the non-short-circuit forms of boolean 'and' and 'or' (<code>&amp;</code>, <code>|</code>, <code>&amp;=</code> and <code>|=</code>).
Although the non-short-circuit versions are occasionally useful, in most cases the short-circuit forms (<code>&amp;&amp;</code>
and <code>||</code>) are intended and such unintentional usages may lead to subtle bugs.
<p>
A quick-fix is suggested to use the short-circuit versions.
</p>
<p><b>Example:</b></p>
<pre><code>
void foo(boolean x, boolean y, boolean z) {
if (x | y) { x |= z; }
}
</code></pre>
<p>After the quick-fix is applied:</p>
<pre><code>
void foo(boolean x, boolean y) {
if (x || y) { x = x || z; }
}
</code></pre>
<!-- tooltip end -->
</body>
</html>