[security-dev 01580]: Re: hg: jdk7/tl/jdk: 6921740: Eliminate warnings from sun.io converters and allow compiling with JAVAC_MAX_WARNINGS=true

Ulf Zibis Ulf.Zibis at gmx.de
Tue Feb 2 05:09:35 PST 2010


Hi,

in most cases you use the empty diamond operator '<>' on instantiation, 
but not for SoftReference: "new SoftReference<Charset>(cs)" in 
AbstractCharsetProvider.java
Why?

I don't see a big advantage for casting to (Class<?>) against (Class) 
for the cache of Converters.java. Wouldn't you better use a small helper 
class:
class CacheEntry {
     String encoding;
     Class<?> converter;
}

Maybe you would like my more general approach, which eliminates the need 
of any XxxxToYyyyZzzz converters:
https://java-nio-charset-enhanced.dev.java.net/source/browse/java-nio-charset-enhanced/tags/milestone3/src/sun/io/Converters.java?rev=530&view=markup
https://java-nio-charset-enhanced.dev.java.net/source/browse/java-nio-charset-enhanced/tags/milestone3/src/sun/io/?rev=530


in AbstractCharsetProvider.java you could simply code:
Charset cs = (Charset)Class.forName(packagePrefix+'.'+cln, true,
         this.getClass().getClassLoader()).newInstance();


-Ulf


Am 02.02.2010 11:55, schrieb ahughes at redhat.com:
> Changeset: 7dadd2951a8b
> Author:    andrew
> Date:      2010-02-02 10:55 +0000
> URL:       http://hg.openjdk.java.net/jdk7/tl/jdk/rev/7dadd2951a8b
>
> 6921740: Eliminate warnings from sun.io converters and allow compiling with JAVAC_MAX_WARNINGS=true
> Summary: Fix sun.io converters unchecked and cast warnings produced by -Xlint:all
> Reviewed-by: alanb, sherman
>
> ! make/java/sun_nio/Makefile
> ! src/share/classes/sun/io/ByteToCharUTF8.java
> ! src/share/classes/sun/io/CharToByteUnicode.java
> ! src/share/classes/sun/io/CharacterEncoding.java
> ! src/share/classes/sun/io/Converters.java
> ! src/share/classes/sun/nio/cs/AbstractCharsetProvider.java
>
>
>    




More information about the security-dev mailing list