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

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>