mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
20 lines
892 B
HTML
20 lines
892 B
HTML
<html>
|
|
<body>
|
|
Reports cast operations between primitive numeric types that may
|
|
result in precision loss.
|
|
<p>Such casts are not necessarily a problem but may result in difficult to
|
|
trace bugs if the loss of precision is unexpected.</p>
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
int a = 420;
|
|
byte b = (byte) a;
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
<p>Use the <b>Ignore casts from int to char</b> option to ignore casts from <code>int</code> to <code>char</code>.
|
|
This type of cast is often used when implementing I/O operations because the <code>read()</code> method of the
|
|
<code>java.io.Reader</code> class returns an <code>int</code>.</p>
|
|
<p>Use the <b>Ignore casts from int 128-255 to byte </b> option to ignore casts of constant values (128-255) from <code>int</code> to
|
|
<code>byte</code>.
|
|
Such values will overflow to negative numbers that still fit inside a byte.</p>
|
|
</body>
|
|
</html> |