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