Code Review 7104650: rawtype warnings in java.nio.charset.Charset and sun.nio.ch.Util

Chris Hegarty chris.hegarty at oracle.com
Tue Oct 25 12:36:59 UTC 2011


The changes to remove warnings from the NIO code (7068616) missed 
java/nio/charset/Charset.java and sun/nio/ch/Util.java. This was not 
spotted at the time as the compiler was not generating raw type warnings 
for anonymous inner classes. It does now, see CR 7090499.

This is not an issue when doing a full build because the classes are 
compiled implicitly, but when re-building then JAVAC_MAX_WARNINGS and 
JAVAC_WARNINGS_FATAL are set by make/java/nio/Makefile and so the 
warning is fatal.

diff -r 72666cd49ac3 src/share/classes/java/nio/charset/Charset.java
--- a/src/share/classes/java/nio/charset/Charset.java   Tue Oct 25 
09:27:20 2011 +0100
+++ b/src/share/classes/java/nio/charset/Charset.java   Tue Oct 25 
13:38:06 2011 +0100
@@ -435,7 +435,7 @@ public abstract class Charset
          AccessController.doPrivileged(new PrivilegedAction<Object>() {
                  public Object run() {
                      try {
-                        Class epc
+                        Class<?> epc
                              = 
Class.forName("sun.nio.cs.ext.ExtendedCharsets");
                          extendedProvider = 
(CharsetProvider)epc.newInstance();
                      } catch (ClassNotFoundException x) {
diff -r 72666cd49ac3 src/share/classes/sun/nio/ch/Util.java
--- a/src/share/classes/sun/nio/ch/Util.java    Tue Oct 25 09:27:20 2011 
+0100
+++ b/src/share/classes/sun/nio/ch/Util.java    Tue Oct 25 13:38:06 2011 
+0100
@@ -363,10 +363,10 @@ class Util {
                      try {
                          Class<?> cl = 
Class.forName("java.nio.DirectByteBuffer");
                          Constructor<?> ctor = cl.getDeclaredConstructor(
-                            new Class[] { int.class,
-                                          long.class,
-                                          FileDescriptor.class,
-                                          Runnable.class });
+                            new Class<?>[] { int.class,
+                                             long.class,
+                                             FileDescriptor.class,
+                                             Runnable.class });
                          ctor.setAccessible(true);
                          directByteBufferConstructor = ctor;
                      } catch (ClassNotFoundException   |
@@ -408,10 +408,10 @@ class Util {
                      try {
                          Class<?> cl = 
Class.forName("java.nio.DirectByteBufferR");
                          Constructor<?> ctor = cl.getDeclaredConstructor(
-                            new Class[] { int.class,
-                                          long.class,
-                                          FileDescriptor.class,
-                                          Runnable.class });
+                            new Class<?>[] { int.class,
+                                             long.class,
+                                             FileDescriptor.class,
+                                             Runnable.class });
                          ctor.setAccessible(true);
                          directByteBufferRConstructor = ctor;
                      } catch (ClassNotFoundException |

-Chris.



More information about the core-libs-dev mailing list