mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
29 lines
845 B
HTML
29 lines
845 B
HTML
<html>
|
|
<body>
|
|
Reports methods with three or more negations.
|
|
Such methods may be confusing.
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
void doSmth(int a, int b, boolean flag1, boolean flag2) {
|
|
if (!flag && !flag2) {
|
|
if (a != b) {
|
|
doOther();
|
|
}
|
|
}
|
|
}
|
|
</code></pre>
|
|
<p>Without negations, the method becomes easier to understand:</p>
|
|
<pre><code>
|
|
void doSmth(int a, int b, boolean flag1, boolean flag2) {
|
|
if (flag1 || flag2 || a == b) return;
|
|
doOther();
|
|
}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
<p>Configure the inspection:</p>
|
|
<ul>
|
|
<li>Use the <b>Ignore negations in 'equals()' methods</b> option to disable the inspection within <code>equals()</code> methods.</li>
|
|
<li>Use the <b>Ignore negations in 'assert' statements</b> to disable the inspection within <code>assert</code> statements.</li>
|
|
</ul>
|
|
</body>
|
|
</html> |