PING: Re: Fix build failure with JAVAC_MAX_WARNINGS=true in sun/nio/cs

Andrew John Hughes ahughes at redhat.com
Tue Jun 8 14:47:13 PDT 2010


On 7 June 2010 23:04, Xueming Shen <xueming.shen at oracle.com> wrote:
> Hi Andrew,
>
> 6959197: When building with JAVAC_MAX_WARNINGS=true, the build fails in
> sun/nio/cs due to the use of -Werror
>
> (1)sun/io/ByteTocharISO2022JP.java
>   #129,  #151
>
>   if ((byte1 & (byte)0x80) != 0){
>
>       if ((byte2 & (byte)0x80) != 0){
>
>
> (byte) casting is not necessary as well?
>

It's necessary.  0x80 is an integer literal
(http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.1)
which requires a lossy narrowing conversion to byte
(http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.3)

> (2)sun/io/ByteToCharJISAutoDetect.java
>
>  we should (if I did not miss anything) simply change the
>  sun/nio/cs/ext/JISAutoDetect.getByteMask1|2 to static, then no longer need
> to
>  have an instance in ByteToCharJISAutoDetect.
>

Well spotted!  Changed.

> (3)sun/nio/cs/ext/EUC_JP_LINUX.java
>
>    encoderJ0208 no longer needed?
>  decodeMappingJ0208.start = 0xa1;
>  decodeMappingJ0208.end = 0xfe;
>
>     seems like we should simply replace decodeMappingJ0208.start/end with
> start/end
>     and the decodeMappingJ0208 is no longer necessary as well.
>

Likewise.

> (4)
>
>  again, it might be better to do something as below. The EUC_JP_xyz are
> something need to
>  be re-written/-re-organized when we have time.
>
>  short[] j0208Index1 = JIS_X_0208_Solaris_Decoder.getIndex1();
>  String[]j0208Index2 = JIS_X_0208_Solaris_Decoder.getIndex2();
>
>   int start = 0xa1;
>   int end = -0xfe;
>
> 100     protected char decodeDouble(int byte1, int byte2) {
> 101             if (byte1 == 0x8e) {
> 102                 return decoderJ0201.decode(byte2 - 256);
> 103             }
> 104 105             if (((byte1 < 0)
> 106                 || (byte1 > j0208Index1.length))
> 107                 || ((byte2 < start)
> 108                 || (byte2 > end)))
> 109                 return REPLACE_CHAR;
> 110 111             char result = super.decodeDouble(byte1, byte2);
> 112             if (result != '\uFFFD') {
> 113                 return result;
> 114             } else {
> 115                 int n = (j0208Index1[byte1 - 0x80] & 0xf) *
> 116                         (end - start + 1)
> 117                         + (byte2 - start);
> 118                 return j0208Index2[j0208Index1[byte1 - 0x80] >>
> 4].charAt(n);
> 119             }
> 120         }
>
>   encoderJ0208 is no longer needed.
>

Fixed.

> (5) sun.nio.cs.ext.PCK.java
>
>   JIS_X_0208_Solaris_Encoder jis0208 is no longer needed
>

Fixed.

New webrev:

http://cr.openjdk.java.net/~andrew/warnings/webrev.04/

Thanks for such a detailed review.  I just fixed the issues that came
up from javac and didn't review the resulting classes in detail.  This
should make them a little cleaner.

> -sherman
>
>
> Andrew John Hughes wrote:
>>
>> On 7 June 2010 19:06, Xueming Shen <xueming.shen at oracle.com> wrote:
>>
>>>
>>> Andrew, I'm going through the webrev now.  Need a little more time.
>>>
>>> -sherman
>>>
>>> Andrew John Hughes wrote:
>>>
>>>>
>>>> On 2 June 2010 18:57, Andrew John Hughes <ahughes at redhat.com> wrote:
>>>>
>>>>
>>>>>
>>>>> When building with JAVAC_MAX_WARNINGS=true, the build fails in
>>>>> sun/nio/cs due to the use of -Werror.
>>>>>
>>>>> The following webrev:
>>>>>
>>>>> http://cr.openjdk.java.net/~andrew/warnings/webrev.03/
>>>>>
>>>>> fixes the remaining warnings exposed by JAVAC_MAX_WARNINGS by:
>>>>>
>>>>> * Removing redundant casts
>>>>> * Adding generic types to a number of List, Map and Class instances
>>>>> * Turning off deprecation warnings locally in make/sun/nio/cs/Makefile
>>>>>
>>>>> Ok to push? If so, can I have a bug ID for this?
>>>>>
>>>>> Thanks,
>>>>> --
>>>>> Andrew :-)
>>>>>
>>>>> Free Java Software Engineer
>>>>> Red Hat, Inc. (http://www.redhat.com)
>>>>>
>>>>> Support Free Java!
>>>>> Contribute to GNU Classpath and the OpenJDK
>>>>> http://www.gnu.org/software/classpath
>>>>> http://openjdk.java.net
>>>>>
>>>>> PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
>>>>> Fingerprint: F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8
>>>>>
>>>>>
>>>>>
>>>>
>>>> Ping! Any feedback on this?
>>>>
>>>>
>>>
>>>
>>
>> Ok, no rush; I didn't know if anyone had even seen the e-mail as there
>> was no response.
>>
>
>



-- 
Andrew :-)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net

PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint: F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8


More information about the nio-dev mailing list