Compiler bug ?
Ulf Zibis
Ulf.Zibis at gmx.de
Tue Jan 26 08:30:58 PST 2010
Hi,
i have:
public class EUC_TW_C_d_b_fastLoop1 extends FastCharset implements
HistoricallyNamedCharset {
private static final byte MIN_BYTE_VALUE =
EUC_TWMapping2.MIN_BYTE_VALUE;
private static final byte MAX_BYTE_VALUE =
EUC_TWMapping2.MAX_BYTE_VALUE;
private static final class Encoder extends FastCharset.Encoder {
static {
for (char off=0, b1=(MIN_BYTE_VALUE&0xff);
b1<=(MAX_BYTE_VALUE&0xff); b1++)
...
}
...
}
...
}
This compiles fine, but equivalent code in own class compiles with errors:
final class Enc_d_n_fastLoop1 extends FastCharset.Encoder {
static {
byte MIN_BYTE_VALUE = EUC_TWMapping2.MIN_BYTE_VALUE;
byte MAX_BYTE_VALUE = EUC_TWMapping2.MAX_BYTE_VALUE;
for (char off=0, b1=(MIN_BYTE_VALUE&0xff);
b1<=(MAX_BYTE_VALUE&0xff); b1++)
...
}
...
}
C:\Projects\nio_charset_j7_EUC_TW\src\sun\nio\cs\ext\Enc_d_n_fastLoop1.java:75:
possible loss of precision
for (char off=0, b1=(MIN_BYTE_VALUE&0xff);
b1<=(MAX_BYTE_VALUE&0xff); b1++)
required: char
found: int
Is that correct ?
For complete sources see:
https://java-nio-charset-enhanced.dev.java.net/source/browse/java-nio-charset-enhanced/branches/j7_EUC_TW/src/sun/nio/cs/ext/?rev=915
Regards,
-Ulf
More information about the compiler-dev
mailing list