7116404: Miscellaneous warnings (java.rmi.**, serialization, some core classes)
authoralanb
Wed, 30 Nov 2011 12:42:26 +0000
changeset 11117 b6e68b1344d4
parent 11116 3e486ce0019d
child 11118 5935bcaa1e5c
7116404: Miscellaneous warnings (java.rmi.**, serialization, some core classes) Reviewed-by: lancea, chegar, smarks
jdk/src/share/classes/java/io/File.java
jdk/src/share/classes/java/io/ObjectInputStream.java
jdk/src/share/classes/java/io/ObjectOutputStream.java
jdk/src/share/classes/java/io/ObjectStreamClass.java
jdk/src/share/classes/java/io/SequenceInputStream.java
jdk/src/share/classes/java/lang/ClassLoader.java
jdk/src/share/classes/java/lang/Enum.java
jdk/src/share/classes/java/lang/Package.java
jdk/src/share/classes/java/lang/Runtime.java
jdk/src/share/classes/java/lang/SecurityManager.java
jdk/src/share/classes/java/lang/System.java
jdk/src/share/classes/java/lang/Thread.java
jdk/src/share/classes/java/lang/ThreadGroup.java
jdk/src/share/classes/java/rmi/MarshalledObject.java
jdk/src/share/classes/java/rmi/dgc/VMID.java
jdk/src/share/classes/java/rmi/server/LogStream.java
jdk/src/share/classes/java/rmi/server/RemoteObject.java
jdk/src/share/classes/sun/misc/JavaLangAccess.java
jdk/src/share/classes/sun/misc/Launcher.java
jdk/src/share/classes/sun/misc/Unsafe.java
jdk/src/share/classes/sun/misc/VM.java
--- a/jdk/src/share/classes/java/io/File.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/java/io/File.java	Wed Nov 30 12:42:26 2011 +0000
@@ -2006,7 +2006,7 @@
         throws IOException
     {
         s.defaultWriteObject();
-        s.writeChar(this.separatorChar); // Add the separator character
+        s.writeChar(separatorChar); // Add the separator character
     }
 
     /**
--- a/jdk/src/share/classes/java/io/ObjectInputStream.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/java/io/ObjectInputStream.java	Wed Nov 30 12:42:26 2011 +0000
@@ -689,9 +689,9 @@
         boolean hasNonPublicInterface = false;
 
         // define proxy in class loader of non-public interface(s), if any
-        Class[] classObjs = new Class[interfaces.length];
+        Class<?>[] classObjs = new Class<?>[interfaces.length];
         for (int i = 0; i < interfaces.length; i++) {
-            Class cl = Class.forName(interfaces[i], false, latestLoader);
+            Class<?> cl = Class.forName(interfaces[i], false, latestLoader);
             if ((cl.getModifiers() & Modifier.PUBLIC) == 0) {
                 if (hasNonPublicInterface) {
                     if (nonPublicLoader != cl.getClassLoader()) {
@@ -1229,7 +1229,7 @@
      * "enableSubclassImplementation" SerializablePermission is checked.
      */
     private void verifySubclass() {
-        Class cl = getClass();
+        Class<?> cl = getClass();
         if (cl == ObjectInputStream.class) {
             return;
         }
@@ -1473,12 +1473,12 @@
      * ClassNotFoundException will be associated with the class' handle in the
      * handle table).
      */
-    private Class readClass(boolean unshared) throws IOException {
+    private Class<?> readClass(boolean unshared) throws IOException {
         if (bin.readByte() != TC_CLASS) {
             throw new InternalError();
         }
         ObjectStreamClass desc = readClassDesc(false);
-        Class cl = desc.forClass();
+        Class<?> cl = desc.forClass();
         passHandle = handles.assign(unshared ? unsharedMarker : cl);
 
         ClassNotFoundException resolveEx = desc.getResolveException();
@@ -1542,7 +1542,7 @@
             ifaces[i] = bin.readUTF();
         }
 
-        Class cl = null;
+        Class<?> cl = null;
         ClassNotFoundException resolveEx = null;
         bin.setBlockDataMode(true);
         try {
@@ -1586,7 +1586,7 @@
                 "failed to read class descriptor").initCause(ex);
         }
 
-        Class cl = null;
+        Class<?> cl = null;
         ClassNotFoundException resolveEx = null;
         bin.setBlockDataMode(true);
         try {
@@ -1643,7 +1643,7 @@
         int len = bin.readInt();
 
         Object array = null;
-        Class cl, ccl = null;
+        Class<?> cl, ccl = null;
         if ((cl = desc.forClass()) != null) {
             ccl = cl.getComponentType();
             array = Array.newInstance(ccl, len);
@@ -1696,7 +1696,7 @@
      * Reads in and returns enum constant, or null if enum type is
      * unresolvable.  Sets passHandle to enum constant's assigned handle.
      */
-    private Enum readEnum(boolean unshared) throws IOException {
+    private Enum<?> readEnum(boolean unshared) throws IOException {
         if (bin.readByte() != TC_ENUM) {
             throw new InternalError();
         }
@@ -1713,24 +1713,26 @@
         }
 
         String name = readString(false);
-        Enum en = null;
-        Class cl = desc.forClass();
+        Enum<?> result = null;
+        Class<?> cl = desc.forClass();
         if (cl != null) {
             try {
-                en = Enum.valueOf(cl, name);
+                @SuppressWarnings("unchecked")
+                Enum<?> en = Enum.valueOf((Class)cl, name);
+                result = en;
             } catch (IllegalArgumentException ex) {
                 throw (IOException) new InvalidObjectException(
                     "enum constant " + name + " does not exist in " +
                     cl).initCause(ex);
             }
             if (!unshared) {
-                handles.setObject(enumHandle, en);
+                handles.setObject(enumHandle, result);
             }
         }
 
         handles.finish(enumHandle);
         passHandle = enumHandle;
-        return en;
+        return result;
     }
 
     /**
@@ -1941,7 +1943,7 @@
         throws IOException
     {
         // REMIND: is isInstance check necessary?
-        Class cl = desc.forClass();
+        Class<?> cl = desc.forClass();
         if (cl != null && obj != null && !cl.isInstance(obj)) {
             throw new ClassCastException();
         }
@@ -2140,7 +2142,7 @@
          * class descriptor, returns -1.  Throws IllegalArgumentException if
          * neither incoming nor local class descriptor contains a match.
          */
-        private int getFieldOffset(String name, Class type) {
+        private int getFieldOffset(String name, Class<?> type) {
             ObjectStreamField field = desc.getField(name, type);
             if (field != null) {
                 return field.getOffset();
@@ -2838,6 +2840,7 @@
             return readUTFBody(readUnsignedShort());
         }
 
+        @SuppressWarnings("deprecation")
         public String readLine() throws IOException {
             return din.readLine();      // deprecated, not worth optimizing
         }
--- a/jdk/src/share/classes/java/io/ObjectOutputStream.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/java/io/ObjectOutputStream.java	Wed Nov 30 12:42:26 2011 +0000
@@ -1034,7 +1034,7 @@
      * "enableSubclassImplementation" SerializablePermission is checked.
      */
     private void verifySubclass() {
-        Class cl = getClass();
+        Class<?> cl = getClass();
         if (cl == ObjectOutputStream.class) {
             return;
         }
@@ -1060,17 +1060,17 @@
      * override security-sensitive non-final methods.  Returns true if subclass
      * is "safe", false otherwise.
      */
-    private static boolean auditSubclass(final Class subcl) {
+    private static boolean auditSubclass(final Class<?> subcl) {
         Boolean result = AccessController.doPrivileged(
             new PrivilegedAction<Boolean>() {
                 public Boolean run() {
-                    for (Class cl = subcl;
+                    for (Class<?> cl = subcl;
                          cl != ObjectOutputStream.class;
                          cl = cl.getSuperclass())
                     {
                         try {
                             cl.getDeclaredMethod(
-                                "writeUnshared", new Class[] { Object.class });
+                                "writeUnshared", new Class<?>[] { Object.class });
                             return Boolean.FALSE;
                         } catch (NoSuchMethodException ex) {
                         }
@@ -1122,11 +1122,11 @@
 
             // check for replacement object
             Object orig = obj;
-            Class cl = obj.getClass();
+            Class<?> cl = obj.getClass();
             ObjectStreamClass desc;
             for (;;) {
                 // REMIND: skip this check for strings/arrays?
-                Class repCl;
+                Class<?> repCl;
                 desc = ObjectStreamClass.lookup(cl, true);
                 if (!desc.hasWriteReplaceMethod() ||
                     (obj = desc.invokeWriteReplace(obj)) == null ||
@@ -1169,7 +1169,7 @@
             } else if (cl.isArray()) {
                 writeArray(obj, desc, unshared);
             } else if (obj instanceof Enum) {
-                writeEnum((Enum) obj, desc, unshared);
+                writeEnum((Enum<?>) obj, desc, unshared);
             } else if (obj instanceof Serializable) {
                 writeOrdinaryObject(obj, desc, unshared);
             } else {
@@ -1204,7 +1204,7 @@
     /**
      * Writes representation of given class to stream.
      */
-    private void writeClass(Class cl, boolean unshared) throws IOException {
+    private void writeClass(Class<?> cl, boolean unshared) throws IOException {
         bout.writeByte(TC_CLASS);
         writeClassDesc(ObjectStreamClass.lookup(cl, true), false);
         handles.assign(unshared ? null : cl);
@@ -1237,7 +1237,7 @@
         bout.writeByte(TC_PROXYCLASSDESC);
         handles.assign(unshared ? null : desc);
 
-        Class cl = desc.forClass();
+        Class<?> cl = desc.forClass();
         Class[] ifaces = cl.getInterfaces();
         bout.writeInt(ifaces.length);
         for (int i = 0; i < ifaces.length; i++) {
@@ -1269,7 +1269,7 @@
             writeClassDescriptor(desc);
         }
 
-        Class cl = desc.forClass();
+        Class<?> cl = desc.forClass();
         bout.setBlockDataMode(true);
         annotateClass(cl);
         bout.setBlockDataMode(false);
@@ -1306,7 +1306,7 @@
         writeClassDesc(desc, false);
         handles.assign(unshared ? null : array);
 
-        Class ccl = desc.forClass().getComponentType();
+        Class<?> ccl = desc.forClass().getComponentType();
         if (ccl.isPrimitive()) {
             if (ccl == Integer.TYPE) {
                 int[] ia = (int[]) array;
@@ -1377,7 +1377,7 @@
     /**
      * Writes given enum constant to stream.
      */
-    private void writeEnum(Enum en,
+    private void writeEnum(Enum<?> en,
                            ObjectStreamClass desc,
                            boolean unshared)
         throws IOException
@@ -1700,7 +1700,7 @@
          * types, and any other non-null type matches assignable types only.
          * Throws IllegalArgumentException if no matching field found.
          */
-        private int getFieldOffset(String name, Class type) {
+        private int getFieldOffset(String name, Class<?> type) {
             ObjectStreamField field = desc.getField(name, type);
             if (field == null) {
                 throw new IllegalArgumentException("no such field " + name +
--- a/jdk/src/share/classes/java/io/ObjectStreamClass.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/java/io/ObjectStreamClass.java	Wed Nov 30 12:42:26 2011 +0000
@@ -144,7 +144,7 @@
     private volatile ClassDataSlot[] dataLayout;
 
     /** serialization-appropriate constructor, or null if none */
-    private Constructor cons;
+    private Constructor<?> cons;
     /** class-defined writeObject method, or null if none */
     private Method writeObjectMethod;
     /** class-defined readObject method, or null if none */
@@ -1308,9 +1308,9 @@
      * Access checks are disabled on the returned constructor (if any), since
      * the defining class may still be non-public.
      */
-    private static Constructor getExternalizableConstructor(Class<?> cl) {
+    private static Constructor<?> getExternalizableConstructor(Class<?> cl) {
         try {
-            Constructor cons = cl.getDeclaredConstructor((Class<?>[]) null);
+            Constructor<?> cons = cl.getDeclaredConstructor((Class<?>[]) null);
             cons.setAccessible(true);
             return ((cons.getModifiers() & Modifier.PUBLIC) != 0) ?
                 cons : null;
@@ -1324,7 +1324,7 @@
      * superclass, or null if none found.  Access checks are disabled on the
      * returned constructor (if any).
      */
-    private static Constructor getSerializableConstructor(Class<?> cl) {
+    private static Constructor<?> getSerializableConstructor(Class<?> cl) {
         Class<?> initCl = cl;
         while (Serializable.class.isAssignableFrom(initCl)) {
             if ((initCl = initCl.getSuperclass()) == null) {
@@ -1332,7 +1332,7 @@
             }
         }
         try {
-            Constructor cons = initCl.getDeclaredConstructor((Class<?>[]) null);
+            Constructor<?> cons = initCl.getDeclaredConstructor((Class<?>[]) null);
             int mods = cons.getModifiers();
             if ((mods & Modifier.PRIVATE) != 0 ||
                 ((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 &&
@@ -1802,7 +1802,7 @@
             signature = getClassSignature(field.getType());
         }
 
-        public MemberSignature(Constructor cons) {
+        public MemberSignature(Constructor<?> cons) {
             member = cons;
             name = cons.getName();
             signature = getMethodSignature(
--- a/jdk/src/share/classes/java/io/SequenceInputStream.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/java/io/SequenceInputStream.java	Wed Nov 30 12:42:26 2011 +0000
@@ -44,7 +44,7 @@
  */
 public
 class SequenceInputStream extends InputStream {
-    Enumeration e;
+    Enumeration<? extends InputStream> e;
     InputStream in;
 
     /**
@@ -85,7 +85,7 @@
      * @param   s2   the second input stream to read.
      */
     public SequenceInputStream(InputStream s1, InputStream s2) {
-        Vector  v = new Vector(2);
+        Vector<InputStream> v = new Vector<>(2);
 
         v.addElement(s1);
         v.addElement(s2);
--- a/jdk/src/share/classes/java/lang/ClassLoader.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/java/lang/ClassLoader.java	Wed Nov 30 12:42:26 2011 +0000
@@ -258,7 +258,7 @@
     private final Set<ProtectionDomain> domains;
 
     // Invoked by the VM to record every loaded class with this loader.
-    void addClass(Class c) {
+    void addClass(Class<?> c) {
         classes.addElement(c);
     }
 
@@ -402,7 +402,7 @@
     {
         synchronized (getClassLoadingLock(name)) {
             // First, check if the class has already been loaded
-            Class c = findLoadedClass(name);
+            Class<?> c = findLoadedClass(name);
             if (c == null) {
                 long t0 = System.nanoTime();
                 try {
@@ -468,7 +468,7 @@
     }
 
     // This method is invoked by the virtual machine to load a class.
-    private Class loadClassInternal(String name)
+    private Class<?> loadClassInternal(String name)
         throws ClassNotFoundException
     {
         // For backward compatibility, explicitly lock on 'this' when
@@ -483,7 +483,7 @@
     }
 
     // Invoked by the VM after loading class with this loader.
-    private void checkPackageAccess(Class cls, ProtectionDomain pd) {
+    private void checkPackageAccess(Class<?> cls, ProtectionDomain pd) {
         final SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
             final String name = cls.getName();
@@ -669,9 +669,9 @@
         return source;
     }
 
-    private Class defineTransformedClass(String name, byte[] b, int off, int len,
-                                         ProtectionDomain pd,
-                                         ClassFormatError cfe, String source)
+    private Class<?> defineTransformedClass(String name, byte[] b, int off, int len,
+                                            ProtectionDomain pd,
+                                            ClassFormatError cfe, String source)
       throws ClassFormatError
     {
         // Class format error - try to transform the bytecode and
@@ -679,7 +679,7 @@
         //
         ClassFileTransformer[] transformers =
             ClassFileTransformer.getTransformers();
-        Class c = null;
+        Class<?> c = null;
 
         if (transformers != null) {
             for (ClassFileTransformer transformer : transformers) {
@@ -704,7 +704,7 @@
         return c;
     }
 
-    private void postDefineClass(Class c, ProtectionDomain pd)
+    private void postDefineClass(Class<?> c, ProtectionDomain pd)
     {
         if (pd.getCodeSource() != null) {
             Certificate certs[] = pd.getCodeSource().getCertificates();
@@ -784,7 +784,7 @@
     {
         protectionDomain = preDefineClass(name, protectionDomain);
 
-        Class c = null;
+        Class<?> c = null;
         String source = defineClassSourceLocation(protectionDomain);
 
         try {
@@ -882,7 +882,7 @@
 
         protectionDomain = preDefineClass(name, protectionDomain);
 
-        Class c = null;
+        Class<?> c = null;
         String source = defineClassSourceLocation(protectionDomain);
 
         try {
@@ -899,15 +899,15 @@
         return c;
     }
 
-    private native Class defineClass0(String name, byte[] b, int off, int len,
-                                      ProtectionDomain pd);
+    private native Class<?> defineClass0(String name, byte[] b, int off, int len,
+                                         ProtectionDomain pd);
 
-    private native Class defineClass1(String name, byte[] b, int off, int len,
-                                      ProtectionDomain pd, String source);
+    private native Class<?> defineClass1(String name, byte[] b, int off, int len,
+                                         ProtectionDomain pd, String source);
 
-    private native Class defineClass2(String name, java.nio.ByteBuffer b,
-                                      int off, int len, ProtectionDomain pd,
-                                      String source);
+    private native Class<?> defineClass2(String name, java.nio.ByteBuffer b,
+                                         int off, int len, ProtectionDomain pd,
+                                         String source);
 
     // true if the name is null or has the potential to be a valid binary name
     private boolean checkName(String name) {
@@ -1010,7 +1010,7 @@
         resolveClass0(c);
     }
 
-    private native void resolveClass0(Class c);
+    private native void resolveClass0(Class<?> c);
 
     /**
      * Finds a class with the specified <a href="#name">binary name</a>,
@@ -1041,7 +1041,7 @@
         if (system == null) {
             if (!checkName(name))
                 throw new ClassNotFoundException(name);
-            Class cls = findBootstrapClass(name);
+            Class<?> cls = findBootstrapClass(name);
             if (cls == null) {
                 throw new ClassNotFoundException(name);
             }
@@ -1054,7 +1054,7 @@
      * Returns a class loaded by the bootstrap class loader;
      * or return null if not found.
      */
-    private Class findBootstrapClassOrNull(String name)
+    private Class<?> findBootstrapClassOrNull(String name)
     {
         if (!checkName(name)) return null;
 
@@ -1062,7 +1062,7 @@
     }
 
     // return null if not found
-    private native Class findBootstrapClass(String name);
+    private native Class<?> findBootstrapClass(String name);
 
     /**
      * Returns the class with the given <a href="#name">binary name</a> if this
@@ -1084,7 +1084,7 @@
         return findLoadedClass0(name);
     }
 
-    private native final Class findLoadedClass0(String name);
+    private native final Class<?> findLoadedClass0(String name);
 
     /**
      * Sets the signers of a class.  This should be invoked after defining a
@@ -1528,7 +1528,7 @@
     // invocation and the desired invoker.
     static ClassLoader getCallerClassLoader() {
         // NOTE use of more generic Reflection.getCallerClass()
-        Class caller = Reflection.getCallerClass(3);
+        Class<?> caller = Reflection.getCallerClass(3);
         // This can be null if the VM is requesting it
         if (caller == null) {
             return null;
@@ -1722,7 +1722,7 @@
         private int jniVersion;
         // the class from which the library is loaded, also indicates
         // the loader this native library belongs.
-        private Class fromClass;
+        private Class<?> fromClass;
         // the canonicalized name of the native library.
         String name;
 
@@ -1730,7 +1730,7 @@
         native long find(String name);
         native void unload();
 
-        public NativeLibrary(Class fromClass, String name) {
+        public NativeLibrary(Class<?> fromClass, String name) {
             this.name = name;
             this.fromClass = fromClass;
         }
@@ -1758,7 +1758,7 @@
         }
         // Invoked in the VM to determine the context class in
         // JNI_Load/JNI_Unload
-        static Class getFromClass() {
+        static Class<?> getFromClass() {
             return ClassLoader.nativeLibraryContext.peek().fromClass;
         }
     }
@@ -1813,7 +1813,7 @@
     }
 
     // Invoked in the java.lang.Runtime class to implement load and loadLibrary.
-    static void loadLibrary(Class fromClass, String name,
+    static void loadLibrary(Class<?> fromClass, String name,
                             boolean isAbsolute) {
         ClassLoader loader =
             (fromClass == null) ? null : fromClass.getClassLoader();
@@ -1860,7 +1860,7 @@
         throw new UnsatisfiedLinkError("no " + name + " in java.library.path");
     }
 
-    private static boolean loadLibrary0(Class fromClass, final File file) {
+    private static boolean loadLibrary0(Class<?> fromClass, final File file) {
         boolean exists = AccessController.doPrivileged(
             new PrivilegedAction<Object>() {
                 public Object run() {
@@ -2194,8 +2194,8 @@
             return parent;
         }
 
-        Constructor ctor = Class.forName(cls, true, parent)
-            .getDeclaredConstructor(new Class[] { ClassLoader.class });
+        Constructor<?> ctor = Class.forName(cls, true, parent)
+            .getDeclaredConstructor(new Class<?>[] { ClassLoader.class });
         ClassLoader sys = (ClassLoader) ctor.newInstance(
             new Object[] { parent });
         Thread.currentThread().setContextClassLoader(sys);
--- a/jdk/src/share/classes/java/lang/Enum.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/java/lang/Enum.java	Wed Nov 30 12:42:26 2011 +0000
@@ -173,8 +173,8 @@
      * method is the order in which the constants are declared.
      */
     public final int compareTo(E o) {
-        Enum other = (Enum)o;
-        Enum self = this;
+        Enum<?> other = (Enum<?>)o;
+        Enum<E> self = this;
         if (self.getClass() != other.getClass() && // optimization
             self.getDeclaringClass() != other.getDeclaringClass())
             throw new ClassCastException();
@@ -193,10 +193,11 @@
      * @return the Class object corresponding to this enum constant's
      *     enum type
      */
+    @SuppressWarnings("unchecked")
     public final Class<E> getDeclaringClass() {
-        Class clazz = getClass();
-        Class zuper = clazz.getSuperclass();
-        return (zuper == Enum.class) ? clazz : zuper;
+        Class<?> clazz = getClass();
+        Class<?> zuper = clazz.getSuperclass();
+        return (zuper == Enum.class) ? (Class<E>)clazz : (Class<E>)zuper;
     }
 
     /**
--- a/jdk/src/share/classes/java/lang/Package.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/java/lang/Package.java	Wed Nov 30 12:42:26 2011 +0000
@@ -608,5 +608,5 @@
     private final String implVendor;
     private final URL sealBase;
     private transient final ClassLoader loader;
-    private transient Class packageInfo;
+    private transient Class<?> packageInfo;
 }
--- a/jdk/src/share/classes/java/lang/Runtime.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/java/lang/Runtime.java	Wed Nov 30 12:42:26 2011 +0000
@@ -780,7 +780,7 @@
         load0(System.getCallerClass(), filename);
     }
 
-    synchronized void load0(Class fromClass, String filename) {
+    synchronized void load0(Class<?> fromClass, String filename) {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
             security.checkLink(filename);
@@ -833,7 +833,7 @@
         loadLibrary0(System.getCallerClass(), libname);
     }
 
-    synchronized void loadLibrary0(Class fromClass, String libname) {
+    synchronized void loadLibrary0(Class<?> fromClass, String libname) {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
             security.checkLink(libname);
--- a/jdk/src/share/classes/java/lang/SecurityManager.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/java/lang/SecurityManager.java	Wed Nov 30 12:42:26 2011 +0000
@@ -400,7 +400,7 @@
      */
     @Deprecated
     protected Class<?> currentLoadedClass() {
-        Class c = currentLoadedClass0();
+        Class<?> c = currentLoadedClass0();
         if ((c != null) && hasAllPermission())
             c = null;
         return c;
@@ -1715,7 +1715,7 @@
         checkPermission(new SecurityPermission(target));
     }
 
-    private native Class currentLoadedClass0();
+    private native Class<?> currentLoadedClass0();
 
     /**
      * Returns the thread group into which to instantiate any new
--- a/jdk/src/share/classes/java/lang/System.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/java/lang/System.java	Wed Nov 30 12:42:26 2011 +0000
@@ -1171,13 +1171,13 @@
     private static void setJavaLangAccess() {
         // Allow privileged classes outside of java.lang
         sun.misc.SharedSecrets.setJavaLangAccess(new sun.misc.JavaLangAccess(){
-            public sun.reflect.ConstantPool getConstantPool(Class klass) {
+            public sun.reflect.ConstantPool getConstantPool(Class<?> klass) {
                 return klass.getConstantPool();
             }
-            public void setAnnotationType(Class klass, AnnotationType type) {
+            public void setAnnotationType(Class<?> klass, AnnotationType type) {
                 klass.setAnnotationType(type);
             }
-            public AnnotationType getAnnotationType(Class klass) {
+            public AnnotationType getAnnotationType(Class<?> klass) {
                 return klass.getAnnotationType();
             }
             public <E extends Enum<E>>
--- a/jdk/src/share/classes/java/lang/Thread.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/java/lang/Thread.java	Wed Nov 30 12:42:26 2011 +0000
@@ -1650,7 +1650,7 @@
      * security-sensitive non-final methods, or else the
      * "enableContextClassLoaderOverride" RuntimePermission is checked.
      */
-    private static boolean isCCLOverridden(Class cl) {
+    private static boolean isCCLOverridden(Class<?> cl) {
         if (cl == Thread.class)
             return false;
 
@@ -1670,21 +1670,21 @@
      * override security-sensitive non-final methods.  Returns true if the
      * subclass overrides any of the methods, false otherwise.
      */
-    private static boolean auditSubclass(final Class subcl) {
+    private static boolean auditSubclass(final Class<?> subcl) {
         Boolean result = AccessController.doPrivileged(
             new PrivilegedAction<Boolean>() {
                 public Boolean run() {
-                    for (Class cl = subcl;
+                    for (Class<?> cl = subcl;
                          cl != Thread.class;
                          cl = cl.getSuperclass())
                     {
                         try {
-                            cl.getDeclaredMethod("getContextClassLoader", new Class[0]);
+                            cl.getDeclaredMethod("getContextClassLoader", new Class<?>[0]);
                             return Boolean.TRUE;
                         } catch (NoSuchMethodException ex) {
                         }
                         try {
-                            Class[] params = {ClassLoader.class};
+                            Class<?>[] params = {ClassLoader.class};
                             cl.getDeclaredMethod("setContextClassLoader", params);
                             return Boolean.TRUE;
                         } catch (NoSuchMethodException ex) {
--- a/jdk/src/share/classes/java/lang/ThreadGroup.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/java/lang/ThreadGroup.java	Wed Nov 30 12:42:26 2011 +0000
@@ -670,6 +670,7 @@
      *     {@link Thread#suspend} for details.
      */
     @Deprecated
+    @SuppressWarnings("deprecation")
     public final void suspend() {
         if (stopOrSuspend(true))
             Thread.currentThread().suspend();
@@ -682,6 +683,7 @@
      * if (and only if) the current thread is found to be in this thread
      * group or one of its subgroups.
      */
+    @SuppressWarnings("deprecation")
     private boolean stopOrSuspend(boolean suspend) {
         boolean suicide = false;
         Thread us = Thread.currentThread();
@@ -731,6 +733,7 @@
      *       deadlock-prone.  See {@link Thread#suspend} for details.
      */
     @Deprecated
+    @SuppressWarnings("deprecation")
     public final void resume() {
         int ngroupsSnapshot;
         ThreadGroup[] groupsSnapshot;
--- a/jdk/src/share/classes/java/rmi/MarshalledObject.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/java/rmi/MarshalledObject.java	Wed Nov 30 12:42:26 2011 +0000
@@ -156,6 +156,7 @@
             (locBytes == null ? null : new ByteArrayInputStream(locBytes));
         MarshalledObjectInputStream in =
             new MarshalledObjectInputStream(bin, lin);
+        @SuppressWarnings("unchecked")
         T obj = (T) in.readObject();
         in.close();
         return obj;
@@ -190,7 +191,7 @@
             return true;
 
         if (obj != null && obj instanceof MarshalledObject) {
-            MarshalledObject other = (MarshalledObject) obj;
+            MarshalledObject<?> other = (MarshalledObject<?>) obj;
 
             // if either is a ref to null, both must be
             if (objBytes == null || other.objBytes == null)
--- a/jdk/src/share/classes/java/rmi/dgc/VMID.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/java/rmi/dgc/VMID.java	Wed Nov 30 12:42:26 2011 +0000
@@ -118,7 +118,7 @@
         StringBuffer result = new StringBuffer();
         if (addr != null)
             for (int i = 0; i < addr.length; ++ i) {
-                int x = (int) (addr[i] & 0xFF);
+                int x = addr[i] & 0xFF;
                 result.append((x < 0x10 ? "0" : "") +
                               Integer.toString(x, 16));
             }
--- a/jdk/src/share/classes/java/rmi/server/LogStream.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/java/rmi/server/LogStream.java	Wed Nov 30 12:42:26 2011 +0000
@@ -39,7 +39,7 @@
 public class LogStream extends PrintStream {
 
     /** table mapping known log names to log stream objects */
-    private static Hashtable    known = new Hashtable(5);
+    private static Map<String,LogStream> known = new HashMap<>(5);
     /** default output stream for new logs */
     private static PrintStream  defaultStream = System.err;
 
@@ -90,7 +90,7 @@
     public static LogStream log(String name) {
         LogStream stream;
         synchronized (known) {
-            stream = (LogStream)known.get(name);
+            stream = known.get(name);
             if (stream == null) {
                 stream = new LogStream(name, defaultStream);
             }
--- a/jdk/src/share/classes/java/rmi/server/RemoteObject.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/java/rmi/server/RemoteObject.java	Wed Nov 30 12:42:26 2011 +0000
@@ -436,7 +436,7 @@
              */
             String internalRefClassName =
                 RemoteRef.packagePrefix + "." + refClassName;
-            Class refClass = Class.forName(internalRefClassName);
+            Class<?> refClass = Class.forName(internalRefClassName);
             try {
                 ref = (RemoteRef) refClass.newInstance();
 
--- a/jdk/src/share/classes/sun/misc/JavaLangAccess.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/sun/misc/JavaLangAccess.java	Wed Nov 30 12:42:26 2011 +0000
@@ -31,19 +31,19 @@
 
 public interface JavaLangAccess {
     /** Return the constant pool for a class. */
-    ConstantPool getConstantPool(Class klass);
+    ConstantPool getConstantPool(Class<?> klass);
 
     /**
      * Set the AnnotationType instance corresponding to this class.
      * (This method only applies to annotation types.)
      */
-    void setAnnotationType(Class klass, AnnotationType annotationType);
+    void setAnnotationType(Class<?> klass, AnnotationType annotationType);
 
     /**
      * Get the AnnotationType instance corresponding to this class.
      * (This method only applies to annotation types.)
      */
-    AnnotationType getAnnotationType(Class klass);
+    AnnotationType getAnnotationType(Class<?> klass);
 
     /**
      * Returns the elements of an enum class or null if the
--- a/jdk/src/share/classes/sun/misc/Launcher.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/sun/misc/Launcher.java	Wed Nov 30 12:42:26 2011 +0000
@@ -295,7 +295,7 @@
         /**
          * Override loadClass so we can checkPackageAccess.
          */
-        public Class loadClass(String name, boolean resolve)
+        public Class<?> loadClass(String name, boolean resolve)
             throws ClassNotFoundException
         {
             int i = name.lastIndexOf('.');
@@ -473,7 +473,7 @@
         public URLStreamHandler createURLStreamHandler(String protocol) {
             String name = PREFIX + "." + protocol + ".Handler";
             try {
-                Class c = Class.forName(name);
+                Class<?> c = Class.forName(name);
                 return (URLStreamHandler)c.newInstance();
             } catch (ReflectiveOperationException e) {
                 throw new InternalError("could not load " + protocol +
--- a/jdk/src/share/classes/sun/misc/Unsafe.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/sun/misc/Unsafe.java	Wed Nov 30 12:42:26 2011 +0000
@@ -81,7 +81,7 @@
      *             access to the system properties.
      */
     public static Unsafe getUnsafe() {
-        Class cc = sun.reflect.Reflection.getCallerClass(2);
+        Class<?> cc = sun.reflect.Reflection.getCallerClass(2);
         if (cc.getClassLoader() != null)
             throw new SecurityException("Unsafe");
         return theUnsafe;
@@ -616,7 +616,7 @@
      * for a given class in one place.
      */
     @Deprecated
-    public Object staticFieldBase(Class c) {
+    public Object staticFieldBase(Class<?> c) {
         Field[] fields = c.getDeclaredFields();
         for (int i = 0; i < fields.length; i++) {
             if (Modifier.isStatic(fields[i].getModifiers())) {
@@ -682,7 +682,7 @@
      * needed in conjunction with obtaining the static field base of a
      * class.
      */
-    public native void ensureClassInitialized(Class c);
+    public native void ensureClassInitialized(Class<?> c);
 
     /**
      * Report the offset of the first element in the storage allocation of a
@@ -694,7 +694,7 @@
      * @see #getInt(Object, long)
      * @see #putInt(Object, long, int)
      */
-    public native int arrayBaseOffset(Class arrayClass);
+    public native int arrayBaseOffset(Class<?> arrayClass);
 
     /** The value of {@code arrayBaseOffset(boolean[].class)} */
     public static final int ARRAY_BOOLEAN_BASE_OFFSET
@@ -743,7 +743,7 @@
      * @see #getInt(Object, long)
      * @see #putInt(Object, long, int)
      */
-    public native int arrayIndexScale(Class arrayClass);
+    public native int arrayIndexScale(Class<?> arrayClass);
 
     /** The value of {@code arrayIndexScale(boolean[].class)} */
     public static final int ARRAY_BOOLEAN_INDEX_SCALE
@@ -805,11 +805,11 @@
      * Tell the VM to define a class, without security checks.  By default, the
      * class loader and protection domain come from the caller's class.
      */
-    public native Class defineClass(String name, byte[] b, int off, int len,
-                                    ClassLoader loader,
-                                    ProtectionDomain protectionDomain);
+    public native Class<?> defineClass(String name, byte[] b, int off, int len,
+                                       ClassLoader loader,
+                                       ProtectionDomain protectionDomain);
 
-    public native Class defineClass(String name, byte[] b, int off, int len);
+    public native Class<?> defineClass(String name, byte[] b, int off, int len);
 
     /**
      * Define a class but do not make it known to the class loader or system dictionary.
@@ -827,12 +827,12 @@
      * @params data      bytes of a class file
      * @params cpPatches where non-null entries exist, they replace corresponding CP entries in data
      */
-    public native Class defineAnonymousClass(Class hostClass, byte[] data, Object[] cpPatches);
+    public native Class<?> defineAnonymousClass(Class<?> hostClass, byte[] data, Object[] cpPatches);
 
 
     /** Allocate an instance but do not run any constructor.
         Initializes the class if it has not yet been. */
-    public native Object allocateInstance(Class cls)
+    public native Object allocateInstance(Class<?> cls)
         throws InstantiationException;
 
     /** Lock the object.  It must get unlocked via {@link #monitorExit}. */
--- a/jdk/src/share/classes/sun/misc/VM.java	Wed Nov 30 10:57:51 2011 +0000
+++ b/jdk/src/share/classes/sun/misc/VM.java	Wed Nov 30 12:42:26 2011 +0000
@@ -48,6 +48,7 @@
         return suspended;
     }
 
+    @SuppressWarnings("deprecation")
     public static boolean allowThreadSuspension(ThreadGroup g, boolean b) {
         return g.allowThreadSuspension(b);
     }