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

27 lines
813 B
HTML

<html>
<body>
Reports assignments that are used as a condition of an <code>if</code>, <code>while</code>, <code>for</code>, or
<code>do</code> statement, or a conditional expression.
<p>Although occasionally intended, this usage is confusing and may indicate a typo, for example, <code>=</code> instead of <code>==</code>.</p>
<p>The quick-fix replaces <code>=</code> with <code>==</code>.</p>
<p><b>Example:</b></p>
<pre><code>
void update(String str, boolean empty) {
// Warning: 'empty' is reassigned,
// not compared to str.isEmpty()
if (empty = str.isEmpty()) {
...
}
}
</code></pre>
<p>After the quick-fix is applied:</p>
<pre><code>
void update(String str, boolean empty) {
if (empty == str.isEmpty()) {
...
}
}
</code></pre>
<!-- tooltip end -->
</body>
</html>