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

35 lines
842 B
HTML

<html>
<body>
Reports integer multiplications and left shifts that are implicitly cast to long.
<p><b>Example:</b></p>
<pre><code>
void f(int i) {
long val = 65536 * i;
}
</code></pre>
<p>After the quick-fix is applied, the code changes to:</p>
<pre><code>
void x(int i) {
long val = 65536<b>L</b> * i;
}
</code></pre>
<p><b>Example:</b></p>
<pre><code>
void f(int i) {
long value = i &lt;&lt; 24;
}
</code></pre>
<p>After the quick-fix is applied, the code changes to:</p>
<pre><code>
void f(int i) {
long value = (long) i &lt;&lt; 24;
}
</code></pre>
<!-- tooltip end -->
<p>
Such multiplications are often a mistake, as overflow truncation may occur unexpectedly.
Converting an <code>int</code> literal to a <code>long</code> literal (<code>65536<b>L</b></code>) fixes the problem.
</p>
</body>
</html>