mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
23 lines
751 B
HTML
23 lines
751 B
HTML
<html>
|
|
<body>
|
|
Reports usages of the non-short-circuit forms of boolean 'and' and 'or' (<code>&</code>, <code>|</code>, <code>&=</code> and <code>|=</code>).
|
|
Although the non-short-circuit versions are occasionally useful, in most cases the short-circuit forms (<code>&&</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> |