mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
27 lines
813 B
HTML
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> |