mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
30 lines
868 B
HTML
30 lines
868 B
HTML
<html>
|
|
<body>
|
|
Reports any usages of variables which are known to be constant.
|
|
<p>This is the case if the (read) use of the variable is surrounded by an
|
|
<code>if</code>, <code>while</code>, or <code>for</code>
|
|
statement with an <code>==</code> condition which compares the variable with a constant.
|
|
In this case, the use of a variable which is known to be constant can be replaced with
|
|
an actual constant.</p>
|
|
<p>Example:</p>
|
|
<pre><code>
|
|
private static void foo(double number) {
|
|
if (number == 1.0) {
|
|
f(number);
|
|
}
|
|
}
|
|
private static void f(double number) {}
|
|
</code></pre>
|
|
<p>After the quick-fix is applied:</p>
|
|
<pre><code>
|
|
private static void foo(double number) {
|
|
if (number == 1.0) {
|
|
f(1.0);
|
|
}
|
|
}
|
|
private static void f(double number) {}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
|
|
</body>
|
|
</html> |