7116954: Misc warnings in java.beans/java.beans.context
authormcimadamore
Thu, 01 Dec 2011 18:34:23 +0000
changeset 11120 f8576c769572
parent 11119 6ff03c1202ce
child 11121 4cdbb7f9480f
7116954: Misc warnings in java.beans/java.beans.context Summary: Remove generic warnings form java.beans and java.beans.context Reviewed-by: alanb, chegar
jdk/src/share/classes/java/beans/BeanDescriptor.java
jdk/src/share/classes/java/beans/Beans.java
jdk/src/share/classes/java/beans/ChangeListenerMap.java
jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java
jdk/src/share/classes/java/beans/Encoder.java
jdk/src/share/classes/java/beans/EventHandler.java
jdk/src/share/classes/java/beans/EventSetDescriptor.java
jdk/src/share/classes/java/beans/FeatureDescriptor.java
jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java
jdk/src/share/classes/java/beans/Introspector.java
jdk/src/share/classes/java/beans/MetaData.java
jdk/src/share/classes/java/beans/MethodDescriptor.java
jdk/src/share/classes/java/beans/NameGenerator.java
jdk/src/share/classes/java/beans/PersistenceDelegate.java
jdk/src/share/classes/java/beans/PropertyChangeSupport.java
jdk/src/share/classes/java/beans/PropertyDescriptor.java
jdk/src/share/classes/java/beans/PropertyEditorSupport.java
jdk/src/share/classes/java/beans/ReflectionUtils.java
jdk/src/share/classes/java/beans/SimpleBeanInfo.java
jdk/src/share/classes/java/beans/Statement.java
jdk/src/share/classes/java/beans/VetoableChangeSupport.java
jdk/src/share/classes/java/beans/XMLEncoder.java
jdk/src/share/classes/java/beans/beancontext/BeanContext.java
jdk/src/share/classes/java/beans/beancontext/BeanContextMembershipEvent.java
--- a/jdk/src/share/classes/java/beans/BeanDescriptor.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/BeanDescriptor.java	Thu Dec 01 18:34:23 2011 +0000
@@ -37,8 +37,8 @@
 
 public class BeanDescriptor extends FeatureDescriptor {
 
-    private Reference<Class> beanClassRef;
-    private Reference<Class> customizerClassRef;
+    private Reference<? extends Class<?>> beanClassRef;
+    private Reference<? extends Class<?>> customizerClassRef;
 
     /**
      * Create a BeanDescriptor for a bean that doesn't have a customizer.
@@ -59,8 +59,8 @@
      *          the bean's Customizer.  For example sun.beans.OurButtonCustomizer.class.
      */
     public BeanDescriptor(Class<?> beanClass, Class<?> customizerClass) {
-        this.beanClassRef = getWeakReference((Class)beanClass);
-        this.customizerClassRef = getWeakReference((Class)customizerClass);
+        this.beanClassRef = getWeakReference(beanClass);
+        this.customizerClassRef = getWeakReference(customizerClass);
 
         String name = beanClass.getName();
         while (name.indexOf('.') >= 0) {
--- a/jdk/src/share/classes/java/beans/Beans.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/Beans.java	Thu Dec 01 18:34:23 2011 +0000
@@ -181,9 +181,9 @@
         // Try to find a serialized object with this name
         final String serName = beanName.replace('.','/').concat(".ser");
         final ClassLoader loader = cls;
-        ins = (InputStream)AccessController.doPrivileged
-            (new PrivilegedAction() {
-                public Object run() {
+        ins = AccessController.doPrivileged
+            (new PrivilegedAction<InputStream>() {
+                public InputStream run() {
                     if (loader == null)
                         return ClassLoader.getSystemResourceAsStream(serName);
                     else
@@ -213,7 +213,7 @@
 
         if (result == null) {
             // No serialized object, try just instantiating the class
-            Class cl;
+            Class<?> cl;
 
             try {
                 cl = ClassFinder.findClass(beanName, cls);
@@ -278,10 +278,10 @@
                     // Now get the URL correponding to the resource name.
 
                     final ClassLoader cloader = cls;
-                    objectUrl = (URL)
+                    objectUrl =
                         AccessController.doPrivileged
-                        (new PrivilegedAction() {
-                            public Object run() {
+                        (new PrivilegedAction<URL>() {
+                            public URL run() {
                                 if (cloader == null)
                                     return ClassLoader.getSystemResource
                                                                 (resourceName);
@@ -326,7 +326,7 @@
                 // now, if there is a BeanContext, add the bean, if applicable.
 
                 if (beanContext != null) {
-                    beanContext.add(result);
+                    unsafeBeanContextAdd(beanContext, result);
                 }
 
                 // If it was deserialized then it was already init-ed.
@@ -344,12 +344,16 @@
                   ((BeansAppletStub)stub).active = true;
                 } else initializer.activate(applet);
 
-            } else if (beanContext != null) beanContext.add(result);
+            } else if (beanContext != null) unsafeBeanContextAdd(beanContext, result);
         }
 
         return result;
     }
 
+    @SuppressWarnings("unchecked")
+    private static void unsafeBeanContextAdd(BeanContext beanContext, Object res) {
+        beanContext.add(res);
+    }
 
     /**
      * From a given bean, obtain an object representing a specified
@@ -496,6 +500,7 @@
     /**
      * Use the given ClassLoader rather than using the system class
      */
+    @SuppressWarnings("rawtypes")
     protected Class resolveClass(ObjectStreamClass classDesc)
         throws IOException, ClassNotFoundException {
 
@@ -511,7 +516,7 @@
 
 class BeansAppletContext implements AppletContext {
     Applet target;
-    Hashtable imageCache = new Hashtable();
+    Hashtable<URL,Object> imageCache = new Hashtable<>();
 
     BeansAppletContext(Applet target) {
         this.target = target;
@@ -556,8 +561,8 @@
         return null;
     }
 
-    public Enumeration getApplets() {
-        Vector applets = new Vector();
+    public Enumeration<Applet> getApplets() {
+        Vector<Applet> applets = new Vector<>();
         applets.addElement(target);
         return applets.elements();
     }
@@ -583,7 +588,7 @@
         return null;
     }
 
-    public Iterator getStreamKeys(){
+    public Iterator<String> getStreamKeys(){
         // We do nothing.
         return null;
     }
--- a/jdk/src/share/classes/java/beans/ChangeListenerMap.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/ChangeListenerMap.java	Thu Dec 01 18:34:23 2011 +0000
@@ -76,7 +76,7 @@
      */
     public final synchronized void add(String name, L listener) {
         if (this.map == null) {
-            this.map = new HashMap<String, L[]>();
+            this.map = new HashMap<>();
         }
         L[] array = this.map.get(name);
         int size = (array != null)
@@ -146,7 +146,7 @@
     public final void set(String name, L[] listeners) {
         if (listeners != null) {
             if (this.map == null) {
-                this.map = new HashMap<String, L[]>();
+                this.map = new HashMap<>();
             }
             this.map.put(name, listeners);
         }
@@ -167,7 +167,7 @@
         if (this.map == null) {
             return newArray(0);
         }
-        List<L> list = new ArrayList<L>();
+        List<L> list = new ArrayList<>();
 
         L[] listeners = this.map.get(null);
         if (listeners != null) {
@@ -239,6 +239,7 @@
      */
     public final L extract(L listener) {
         while (listener instanceof EventListenerProxy) {
+            @SuppressWarnings("unchecked")
             EventListenerProxy<L> proxy = (EventListenerProxy<L>) listener;
             listener = proxy.getListener();
         }
--- a/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java	Thu Dec 01 18:34:23 2011 +0000
@@ -95,7 +95,7 @@
         this.constructor = constructorPropertyNames;
     }
 
-    private static boolean definesEquals(Class type) {
+    private static boolean definesEquals(Class<?> type) {
         try {
             return type == type.getMethod("equals", Object.class).getDeclaringClass();
         }
@@ -153,7 +153,7 @@
      */
     protected Expression instantiate(Object oldInstance, Encoder out) {
         int nArgs = constructor.length;
-        Class type = oldInstance.getClass();
+        Class<?> type = oldInstance.getClass();
         Object[] constructorArgs = new Object[nArgs];
         for(int i = 0; i < nArgs; i++) {
             try {
@@ -167,7 +167,7 @@
         return new Expression(oldInstance, oldInstance.getClass(), "new", constructorArgs);
     }
 
-    private Method findMethod(Class type, String property) {
+    private Method findMethod(Class<?> type, String property) {
         if (property == null) {
             throw new IllegalArgumentException("Property name is null");
         }
@@ -182,7 +182,7 @@
         return method;
     }
 
-    private void doProperty(Class type, PropertyDescriptor pd, Object oldInstance, Object newInstance, Encoder out) throws Exception {
+    private void doProperty(Class<?> type, PropertyDescriptor pd, Object oldInstance, Object newInstance, Encoder out) throws Exception {
         Method getter = pd.getReadMethod();
         Method setter = pd.getWriteMethod();
 
@@ -218,7 +218,7 @@
     }
 
     // Write out the properties of this instance.
-    private void initBean(Class type, Object oldInstance, Object newInstance, Encoder out) {
+    private void initBean(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
         for (Field field : type.getFields()) {
             int mod = field.getModifiers();
             if (Modifier.isFinal(mod) || Modifier.isStatic(mod) || Modifier.isTransient(mod)) {
@@ -288,7 +288,7 @@
             if (d.isTransient()) {
                 continue;
             }
-            Class listenerType = d.getListenerType();
+            Class<?> listenerType = d.getListenerType();
 
 
             // The ComponentListener is added automatically, when
@@ -318,7 +318,7 @@
             }
             catch (Exception e2) {
                 try {
-                    Method m = type.getMethod("getListeners", new Class[]{Class.class});
+                    Method m = type.getMethod("getListeners", new Class<?>[]{Class.class});
                     oldL = (EventListener[])MethodUtil.invoke(m, oldInstance, new Object[]{listenerType});
                     newL = (EventListener[])MethodUtil.invoke(m, newInstance, new Object[]{listenerType});
                 }
@@ -401,7 +401,7 @@
         }
     }
 
-    private static PropertyDescriptor getPropertyDescriptor(Class type, String property) {
+    private static PropertyDescriptor getPropertyDescriptor(Class<?> type, String property) {
         try {
             for (PropertyDescriptor pd : Introspector.getBeanInfo(type).getPropertyDescriptors()) {
                 if (property.equals(pd.getName()))
--- a/jdk/src/share/classes/java/beans/Encoder.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/Encoder.java	Thu Dec 01 18:34:23 2011 +0000
@@ -47,10 +47,10 @@
 
 public class Encoder {
     private final PersistenceDelegateFinder finder = new PersistenceDelegateFinder();
-    private Map bindings = new IdentityHashMap();
+    private Map<Object, Expression> bindings = new IdentityHashMap<>();
     private ExceptionListener exceptionListener;
     boolean executeStatements = true;
-    private Map attributes;
+    private Map<Object, Object> attributes;
 
     /**
      * Write the specified object to the output stream.
@@ -221,7 +221,7 @@
      * @see #get
      */
     public Object remove(Object oldInstance) {
-        Expression exp = (Expression)bindings.remove(oldInstance);
+        Expression exp = bindings.remove(oldInstance);
         return getValue(exp);
     }
 
@@ -242,7 +242,7 @@
             oldInstance.getClass() == String.class) {
             return oldInstance;
         }
-        Expression exp = (Expression)bindings.get(oldInstance);
+        Expression exp = bindings.get(oldInstance);
         return getValue(exp);
     }
 
@@ -331,7 +331,7 @@
     // Package private method for setting an attributes table for the encoder
     void setAttribute(Object key, Object value) {
         if (attributes == null) {
-            attributes = new HashMap();
+            attributes = new HashMap<>();
         }
         attributes.put(key, value);
     }
--- a/jdk/src/share/classes/java/beans/EventHandler.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/EventHandler.java	Thu Dec 01 18:34:23 2011 +0000
@@ -385,14 +385,14 @@
             if (target != null) {
                 getter = Statement.getMethod(target.getClass(),
                                       "get" + NameGenerator.capitalize(first),
-                                      new Class[]{});
+                                      new Class<?>[]{});
                 if (getter == null) {
                     getter = Statement.getMethod(target.getClass(),
                                    "is" + NameGenerator.capitalize(first),
-                                   new Class[]{});
+                                   new Class<?>[]{});
                 }
                 if (getter == null) {
-                    getter = Statement.getMethod(target.getClass(), first, new Class[]{});
+                    getter = Statement.getMethod(target.getClass(), first, new Class<?>[]{});
                 }
             }
             if (getter == null) {
@@ -450,12 +450,12 @@
 
             if (eventPropertyName == null) {     // Nullary method.
                 newArgs = new Object[]{};
-                argTypes = new Class[]{};
+                argTypes = new Class<?>[]{};
             }
             else {
                 Object input = applyGetters(arguments[0], getEventPropertyName());
                 newArgs = new Object[]{input};
-                argTypes = new Class[]{input == null ? null :
+                argTypes = new Class<?>[]{input == null ? null :
                                        input.getClass()};
             }
             try {
@@ -674,6 +674,7 @@
      *
      * @see EventHandler
      */
+    @SuppressWarnings("unchecked")
     public static <T> T create(Class<T> listenerInterface,
                                Object target, String action,
                                String eventPropertyName,
@@ -688,7 +689,7 @@
                           "listenerInterface must be non-null");
         }
         return (T)Proxy.newProxyInstance(target.getClass().getClassLoader(),
-                                         new Class[] {listenerInterface},
+                                         new Class<?>[] {listenerInterface},
                                          eventHandler);
     }
 }
--- a/jdk/src/share/classes/java/beans/EventSetDescriptor.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/EventSetDescriptor.java	Thu Dec 01 18:34:23 2011 +0000
@@ -45,7 +45,7 @@
     private MethodDescriptor getMethodDescriptor;
 
     private Reference<Method[]> listenerMethodsRef;
-    private Reference<Class> listenerTypeRef;
+    private Reference<? extends Class<?>> listenerTypeRef;
 
     private boolean unicast;
     private boolean inDefaultEventSet = true;
@@ -91,7 +91,7 @@
         }
     }
 
-    private static String getListenerClassName(Class cls) {
+    private static String getListenerClassName(Class<?> cls) {
         String className = cls.getName();
         return className.substring(className.lastIndexOf('.') + 1);
     }
@@ -182,7 +182,7 @@
         }
     }
 
-    private static Method getMethod(Class cls, String name, int args)
+    private static Method getMethod(Class<?> cls, String name, int args)
         throws IntrospectionException {
         if (name == null) {
             return null;
@@ -295,7 +295,7 @@
                 : null;
     }
 
-    private void setListenerType(Class cls) {
+    private void setListenerType(Class<?> cls) {
         this.listenerTypeRef = getWeakReference(cls);
     }
 
--- a/jdk/src/share/classes/java/beans/FeatureDescriptor.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/FeatureDescriptor.java	Thu Dec 01 18:34:23 2011 +0000
@@ -51,7 +51,7 @@
 public class FeatureDescriptor {
     private static final String TRANSIENT = "transient";
 
-    private Reference<Class> classRef;
+    private Reference<? extends Class<?>> classRef;
 
     /**
      * Constructs a <code>FeatureDescriptor</code>.
@@ -284,7 +284,7 @@
      */
     private Hashtable<String, Object> getTable() {
         if (this.table == null) {
-            this.table = new Hashtable<String, Object>();
+            this.table = new Hashtable<>();
         }
         return this.table;
     }
@@ -317,11 +317,11 @@
 
     // Package private methods for recreating the weak/soft referent
 
-    void setClass0(Class cls) {
+    void setClass0(Class<?> cls) {
         this.classRef = getWeakReference(cls);
     }
 
-    Class getClass0() {
+    Class<?> getClass0() {
         return (this.classRef != null)
                 ? this.classRef.get()
                 : null;
@@ -336,7 +336,7 @@
      */
     static <T> Reference<T> getSoftReference(T object) {
         return (object != null)
-                ? new SoftReference<T>(object)
+                ? new SoftReference<>(object)
                 : null;
     }
 
@@ -349,7 +349,7 @@
      */
     static <T> Reference<T> getWeakReference(T object) {
         return (object != null)
-                ? new WeakReference<T>(object)
+                ? new WeakReference<>(object)
                 : null;
     }
 
@@ -363,7 +363,7 @@
      * @see Method#getGenericReturnType
      * @see Method#getReturnType
      */
-    static Class getReturnType(Class base, Method method) {
+    static Class<?> getReturnType(Class<?> base, Method method) {
         if (base == null) {
             base = method.getDeclaringClass();
         }
@@ -380,7 +380,7 @@
      * @see Method#getGenericParameterTypes
      * @see Method#getParameterTypes
      */
-    static Class[] getParameterTypes(Class base, Method method) {
+    static Class<?>[] getParameterTypes(Class<?> base, Method method) {
         if (base == null) {
             base = method.getDeclaringClass();
         }
@@ -425,7 +425,7 @@
     void appendTo(StringBuilder sb) {
     }
 
-    static void appendTo(StringBuilder sb, String name, Reference reference) {
+    static void appendTo(StringBuilder sb, String name, Reference<?> reference) {
         if (reference != null) {
             appendTo(sb, name, reference.get());
         }
--- a/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java	Thu Dec 01 18:34:23 2011 +0000
@@ -40,7 +40,7 @@
 
 public class IndexedPropertyDescriptor extends PropertyDescriptor {
 
-    private Reference<Class> indexedPropertyTypeRef;
+    private Reference<? extends Class<?>> indexedPropertyTypeRef;
     private Reference<Method> indexedReadMethodRef;
     private Reference<Method> indexedWriteMethodRef;
 
@@ -175,14 +175,14 @@
     public synchronized Method getIndexedReadMethod() {
         Method indexedReadMethod = getIndexedReadMethod0();
         if (indexedReadMethod == null) {
-            Class cls = getClass0();
+            Class<?> cls = getClass0();
             if (cls == null ||
                 (indexedReadMethodName == null && indexedReadMethodRef == null)) {
                 // the Indexed readMethod was explicitly set to null.
                 return null;
             }
             if (indexedReadMethodName == null) {
-                Class type = getIndexedPropertyType0();
+                Class<?> type = getIndexedPropertyType0();
                 if (type == boolean.class || type == null) {
                     indexedReadMethodName = Introspector.IS_PREFIX + getBaseName();
                 } else {
@@ -190,7 +190,7 @@
                 }
             }
 
-            Class[] args = { int.class };
+            Class<?>[] args = { int.class };
             indexedReadMethod = Introspector.findMethod(cls, indexedReadMethodName, 1, args);
             if (indexedReadMethod == null) {
                 // no "is" method, so look for a "get" method.
@@ -240,7 +240,7 @@
     public synchronized Method getIndexedWriteMethod() {
         Method indexedWriteMethod = getIndexedWriteMethod0();
         if (indexedWriteMethod == null) {
-            Class cls = getClass0();
+            Class<?> cls = getClass0();
             if (cls == null ||
                 (indexedWriteMethodName == null && indexedWriteMethodRef == null)) {
                 // the Indexed writeMethod was explicitly set to null.
@@ -250,14 +250,14 @@
             // We need the indexed type to ensure that we get the correct method.
             // Cannot use the getIndexedPropertyType method since that could
             // result in an infinite loop.
-            Class type = getIndexedPropertyType0();
+            Class<?> type = getIndexedPropertyType0();
             if (type == null) {
                 try {
                     type = findIndexedPropertyType(getIndexedReadMethod(), null);
                     setIndexedPropertyType(type);
                 } catch (IntrospectionException ex) {
                     // Set iprop type to be the classic type
-                    Class propType = getPropertyType();
+                    Class<?> propType = getPropertyType();
                     if (propType.isArray()) {
                         type = propType.getComponentType();
                     }
@@ -268,7 +268,7 @@
                 indexedWriteMethodName = Introspector.SET_PREFIX + getBaseName();
             }
 
-            Class[] args = (type == null) ? null : new Class[] { int.class, type };
+            Class<?>[] args = (type == null) ? null : new Class<?>[] { int.class, type };
             indexedWriteMethod = Introspector.findMethod(cls, indexedWriteMethodName, 2, args);
             if (indexedWriteMethod != null) {
                 if (!indexedWriteMethod.getReturnType().equals(void.class)) {
@@ -289,7 +289,7 @@
         throws IntrospectionException {
 
         // If the indexed property type has not been set, then set it.
-        Class type = findIndexedPropertyType(getIndexedReadMethod(),
+        Class<?> type = findIndexedPropertyType(getIndexedReadMethod(),
                                              writeMethod);
         setIndexedPropertyType(type);
         setIndexedWriteMethod0(writeMethod);
@@ -319,7 +319,7 @@
      *         or {@code null} if the type cannot be determined
      */
     public synchronized Class<?> getIndexedPropertyType() {
-        Class type = getIndexedPropertyType0();
+        Class<?> type = getIndexedPropertyType0();
         if (type == null) {
             try {
                 type = findIndexedPropertyType(getIndexedReadMethod(),
@@ -334,11 +334,11 @@
 
     // Private methods which set get/set the Reference objects
 
-    private void setIndexedPropertyType(Class type) {
+    private void setIndexedPropertyType(Class<?> type) {
         this.indexedPropertyTypeRef = getWeakReference(type);
     }
 
-    private Class getIndexedPropertyType0() {
+    private Class<?> getIndexedPropertyType0() {
         return (this.indexedPropertyTypeRef != null)
                 ? this.indexedPropertyTypeRef.get()
                 : null;
@@ -356,10 +356,10 @@
                 : null;
     }
 
-    private Class findIndexedPropertyType(Method indexedReadMethod,
+    private Class<?> findIndexedPropertyType(Method indexedReadMethod,
                                           Method indexedWriteMethod)
         throws IntrospectionException {
-        Class indexedPropertyType = null;
+        Class<?> indexedPropertyType = null;
 
         if (indexedReadMethod != null) {
             Class params[] = getParameterTypes(getClass0(), indexedReadMethod);
@@ -389,7 +389,7 @@
             }
             indexedPropertyType = params[1];
         }
-        Class propertyType = getPropertyType();
+        Class<?> propertyType = getPropertyType();
         if (propertyType != null && (!propertyType.isArray() ||
                                      propertyType.getComponentType() != indexedPropertyType)) {
             throw new IntrospectionException("type mismatch between indexed and non-indexed methods: "
--- a/jdk/src/share/classes/java/beans/Introspector.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/Introspector.java	Thu Dec 01 18:34:23 2011 +0000
@@ -99,17 +99,17 @@
 
     // Static Caches to speed up introspection.
     private static WeakCache<Class<?>, Method[]> declaredMethodCache =
-            new WeakCache<Class<?>, Method[]>();
+            new WeakCache<>();
 
     private static final Object BEANINFO_CACHE = new Object();
 
-    private Class beanClass;
+    private Class<?> beanClass;
     private BeanInfo explicitBeanInfo;
     private BeanInfo superBeanInfo;
     private BeanInfo additionalBeanInfo[];
 
     private boolean propertyChangeSource = false;
-    private static Class eventListenerType = EventListener.class;
+    private static Class<EventListener> eventListenerType = EventListener.class;
 
     // These should be removed.
     private String defaultEventName;
@@ -117,14 +117,14 @@
     private int defaultEventIndex = -1;
     private int defaultPropertyIndex = -1;
 
-    // Methods maps from Method objects to MethodDescriptors
-    private Map methods;
+    // Methods maps from Method names to MethodDescriptors
+    private Map<String, MethodDescriptor> methods;
 
     // properties maps from String names to PropertyDescriptors
-    private Map properties;
+    private Map<String, PropertyDescriptor> properties;
 
     // events maps from String names to EventSetDescriptors
-    private Map events;
+    private Map<String, EventSetDescriptor> events;
 
     private final static EventSetDescriptor[] EMPTY_EVENTSETDESCRIPTORS = new EventSetDescriptor[0];
 
@@ -163,9 +163,11 @@
         Map<Class<?>, BeanInfo> beanInfoCache;
         BeanInfo beanInfo;
         synchronized (BEANINFO_CACHE) {
-            beanInfoCache = (Map<Class<?>, BeanInfo>) AppContext.getAppContext().get(BEANINFO_CACHE);
+            @SuppressWarnings("unchecked")
+            Map<Class<?>, BeanInfo> temp = beanInfoCache =
+                    (Map<Class<?>, BeanInfo>) AppContext.getAppContext().get(BEANINFO_CACHE);
             if (beanInfoCache == null) {
-                beanInfoCache = new WeakHashMap<Class<?>, BeanInfo>();
+                beanInfoCache = new WeakHashMap<>();
                 AppContext.getAppContext().put(BEANINFO_CACHE, beanInfoCache);
             }
             beanInfo = beanInfoCache.get(beanClass);
@@ -343,7 +345,7 @@
 
     public static void flushCaches() {
         synchronized (BEANINFO_CACHE) {
-            Map beanInfoCache = (Map) AppContext.getAppContext().get(BEANINFO_CACHE);
+            Map<?,?> beanInfoCache = (Map) AppContext.getAppContext().get(BEANINFO_CACHE);
             if (beanInfoCache != null) {
                 beanInfoCache.clear();
             }
@@ -371,7 +373,8 @@
             throw new NullPointerException();
         }
         synchronized (BEANINFO_CACHE) {
-            Map beanInfoCache = (Map) AppContext.getAppContext().get(BEANINFO_CACHE);
+            @SuppressWarnings("unchecked")
+            Map<Class<?>, ?> beanInfoCache = (Map<Class<?>, ?>) AppContext.getAppContext().get(BEANINFO_CACHE);
             if (beanInfoCache != null) {
                 beanInfoCache.put(clz, null);
             }
@@ -383,14 +386,14 @@
     //                  Private implementation methods
     //======================================================================
 
-    private Introspector(Class beanClass, Class stopClass, int flags)
+    private Introspector(Class<?> beanClass, Class<?> stopClass, int flags)
                                             throws IntrospectionException {
         this.beanClass = beanClass;
 
         // Check stopClass is a superClass of startClass.
         if (stopClass != null) {
             boolean isSuper = false;
-            for (Class c = beanClass.getSuperclass(); c != null; c = c.getSuperclass()) {
+            for (Class<?> c = beanClass.getSuperclass(); c != null; c = c.getSuperclass()) {
                 if (c == stopClass) {
                     isSuper = true;
                 }
@@ -405,7 +408,7 @@
             explicitBeanInfo = findExplicitBeanInfo(beanClass);
         }
 
-        Class superClass = beanClass.getSuperclass();
+        Class<?> superClass = beanClass.getSuperclass();
         if (superClass != stopClass) {
             int newFlags = flags;
             if (newFlags == IGNORE_IMMEDIATE_BEANINFO) {
@@ -451,7 +454,7 @@
      * @param beanClass  the class type of the bean
      * @return Instance of an explicit BeanInfo class or null if one isn't found.
      */
-    private static BeanInfo findExplicitBeanInfo(Class beanClass) {
+    private static BeanInfo findExplicitBeanInfo(Class<?> beanClass) {
         return getFinder().find(beanClass);
     }
 
@@ -501,8 +504,8 @@
                     continue;
                 }
                 String name = method.getName();
-                Class argTypes[] = method.getParameterTypes();
-                Class resultType = method.getReturnType();
+                Class<?>[] argTypes = method.getParameterTypes();
+                Class<?> resultType = method.getReturnType();
                 int argCount = argTypes.length;
                 PropertyDescriptor pd = null;
 
@@ -560,8 +563,8 @@
         processPropertyDescriptors();
 
         // Allocate and populate the result array.
-        PropertyDescriptor result[] = new PropertyDescriptor[properties.size()];
-        result = (PropertyDescriptor[])properties.values().toArray(result);
+        PropertyDescriptor result[] =
+                properties.values().toArray(new PropertyDescriptor[properties.size()]);
 
         // Set the default index.
         if (defaultPropertyName != null) {
@@ -575,16 +578,16 @@
         return result;
     }
 
-    private HashMap pdStore = new HashMap();
+    private HashMap<String, List<PropertyDescriptor>> pdStore = new HashMap<>();
 
     /**
      * Adds the property descriptor to the list store.
      */
     private void addPropertyDescriptor(PropertyDescriptor pd) {
         String propName = pd.getName();
-        List list = (List)pdStore.get(propName);
+        List<PropertyDescriptor> list = pdStore.get(propName);
         if (list == null) {
-            list = new ArrayList();
+            list = new ArrayList<>();
             pdStore.put(propName, list);
         }
         if (this.beanClass != pd.getClass0()) {
@@ -639,25 +642,25 @@
      */
     private void processPropertyDescriptors() {
         if (properties == null) {
-            properties = new TreeMap();
+            properties = new TreeMap<>();
         }
 
-        List list;
+        List<PropertyDescriptor> list;
 
         PropertyDescriptor pd, gpd, spd;
         IndexedPropertyDescriptor ipd, igpd, ispd;
 
-        Iterator it = pdStore.values().iterator();
+        Iterator<List<PropertyDescriptor>> it = pdStore.values().iterator();
         while (it.hasNext()) {
             pd = null; gpd = null; spd = null;
             ipd = null; igpd = null; ispd = null;
 
-            list = (List)it.next();
+            list = it.next();
 
             // First pass. Find the latest getter method. Merge properties
             // of previous getter methods.
             for (int i = 0; i < list.size(); i++) {
-                pd = (PropertyDescriptor)list.get(i);
+                pd = list.get(i);
                 if (pd instanceof IndexedPropertyDescriptor) {
                     ipd = (IndexedPropertyDescriptor)pd;
                     if (ipd.getIndexedReadMethod() != null) {
@@ -686,7 +689,7 @@
             // Second pass. Find the latest setter method which
             // has the same type as the getter method.
             for (int i = 0; i < list.size(); i++) {
-                pd = (PropertyDescriptor)list.get(i);
+                pd = list.get(i);
                 if (pd instanceof IndexedPropertyDescriptor) {
                     ipd = (IndexedPropertyDescriptor)pd;
                     if (ipd.getIndexedWriteMethod() != null) {
@@ -804,7 +807,7 @@
             // which does not have getter and setter methods.
             // See regression bug 4984912.
             if ( (pd == null) && (list.size() > 0) ) {
-                pd = (PropertyDescriptor) list.get(0);
+                pd = list.get(0);
             }
 
             if (pd != null) {
@@ -823,8 +826,8 @@
                                                        PropertyDescriptor pd) {
         PropertyDescriptor result = null;
 
-        Class propType = pd.getPropertyType();
-        Class ipropType = ipd.getIndexedPropertyType();
+        Class<?> propType = pd.getPropertyType();
+        Class<?> ipropType = ipd.getIndexedPropertyType();
 
         if (propType.isArray() && propType.getComponentType() == ipropType) {
             if (pd.getClass0().isAssignableFrom(ipd.getClass0())) {
@@ -858,7 +861,7 @@
                 if (write == null && read != null) {
                     write = findMethod(result.getClass0(),
                                        SET_PREFIX + NameGenerator.capitalize(result.getName()), 1,
-                                       new Class[] { FeatureDescriptor.getReturnType(result.getClass0(), read) });
+                                       new Class<?>[] { FeatureDescriptor.getReturnType(result.getClass0(), read) });
                     if (write != null) {
                         try {
                             result.setWriteMethod(write);
@@ -898,7 +901,7 @@
      */
     private EventSetDescriptor[] getTargetEventInfo() throws IntrospectionException {
         if (events == null) {
-            events = new HashMap();
+            events = new HashMap<>();
         }
 
         // Check if the bean has its own BeanInfo that will provide
@@ -949,9 +952,9 @@
             // Find all suitable "add", "remove" and "get" Listener methods
             // The name of the listener type is the key for these hashtables
             // i.e, ActionListener
-            Map adds = null;
-            Map removes = null;
-            Map gets = null;
+            Map<String, Method> adds = null;
+            Map<String, Method> removes = null;
+            Map<String, Method> gets = null;
 
             for (int i = 0; i < methodList.length; i++) {
                 Method method = methodList[i];
@@ -970,8 +973,8 @@
                     continue;
                 }
 
-                Class argTypes[] = FeatureDescriptor.getParameterTypes(beanClass, method);
-                Class resultType = FeatureDescriptor.getReturnType(beanClass, method);
+                Class<?>[] argTypes = FeatureDescriptor.getParameterTypes(beanClass, method);
+                Class<?> resultType = FeatureDescriptor.getReturnType(beanClass, method);
 
                 if (name.startsWith(ADD_PREFIX) && argTypes.length == 1 &&
                     resultType == Void.TYPE &&
@@ -980,7 +983,7 @@
                     if (listenerName.length() > 0 &&
                         argTypes[0].getName().endsWith(listenerName)) {
                         if (adds == null) {
-                            adds = new HashMap();
+                            adds = new HashMap<>();
                         }
                         adds.put(listenerName, method);
                     }
@@ -992,7 +995,7 @@
                     if (listenerName.length() > 0 &&
                         argTypes[0].getName().endsWith(listenerName)) {
                         if (removes == null) {
-                            removes = new HashMap();
+                            removes = new HashMap<>();
                         }
                         removes.put(listenerName, method);
                     }
@@ -1005,7 +1008,7 @@
                     if (listenerName.length() > 0 &&
                         resultType.getComponentType().getName().endsWith(listenerName)) {
                         if (gets == null) {
-                            gets = new HashMap();
+                            gets = new HashMap<>();
                         }
                         gets.put(listenerName, method);
                     }
@@ -1015,26 +1018,26 @@
             if (adds != null && removes != null) {
                 // Now look for matching addFooListener+removeFooListener pairs.
                 // Bonus if there is a matching getFooListeners method as well.
-                Iterator keys = adds.keySet().iterator();
+                Iterator<String> keys = adds.keySet().iterator();
                 while (keys.hasNext()) {
-                    String listenerName = (String) keys.next();
+                    String listenerName = keys.next();
                     // Skip any "add" which doesn't have a matching "remove" or
                     // a listener name that doesn't end with Listener
                     if (removes.get(listenerName) == null || !listenerName.endsWith("Listener")) {
                         continue;
                     }
                     String eventName = decapitalize(listenerName.substring(0, listenerName.length()-8));
-                    Method addMethod = (Method)adds.get(listenerName);
-                    Method removeMethod = (Method)removes.get(listenerName);
+                    Method addMethod = adds.get(listenerName);
+                    Method removeMethod = removes.get(listenerName);
                     Method getMethod = null;
                     if (gets != null) {
-                        getMethod = (Method)gets.get(listenerName);
+                        getMethod = gets.get(listenerName);
                     }
-                    Class argType = FeatureDescriptor.getParameterTypes(beanClass, addMethod)[0];
+                    Class<?> argType = FeatureDescriptor.getParameterTypes(beanClass, addMethod)[0];
 
                     // generate a list of Method objects for each of the target methods:
                     Method allMethods[] = getPublicDeclaredMethods(argType);
-                    List validMethods = new ArrayList(allMethods.length);
+                    List<Method> validMethods = new ArrayList<>(allMethods.length);
                     for (int i = 0; i < allMethods.length; i++) {
                         if (allMethods[i] == null) {
                             continue;
@@ -1044,7 +1047,7 @@
                             validMethods.add(allMethods[i]);
                         }
                     }
-                    Method[] methods = (Method[])validMethods.toArray(new Method[validMethods.size()]);
+                    Method[] methods = validMethods.toArray(new Method[validMethods.size()]);
 
                     EventSetDescriptor esd = new EventSetDescriptor(eventName, argType,
                                                                     methods, addMethod,
@@ -1067,7 +1070,7 @@
         } else {
             // Allocate and populate the result array.
             result = new EventSetDescriptor[events.size()];
-            result = (EventSetDescriptor[])events.values().toArray(result);
+            result = events.values().toArray(result);
 
             // Set the default index.
             if (defaultEventName != null) {
@@ -1086,7 +1089,7 @@
         if (esd.getName().equals("propertyChange")) {
             propertyChangeSource = true;
         }
-        EventSetDescriptor old = (EventSetDescriptor)events.get(key);
+        EventSetDescriptor old = events.get(key);
         if (old == null) {
             events.put(key, esd);
             return;
@@ -1101,7 +1104,7 @@
      */
     private MethodDescriptor[] getTargetMethodInfo() {
         if (methods == null) {
-            methods = new HashMap(100);
+            methods = new HashMap<>(100);
         }
 
         // Check if the bean has its own BeanInfo that will provide
@@ -1154,7 +1157,7 @@
 
         // Allocate and populate the result array.
         MethodDescriptor result[] = new MethodDescriptor[methods.size()];
-        result = (MethodDescriptor[])methods.values().toArray(result);
+        result = methods.values().toArray(result);
 
         return result;
     }
@@ -1165,7 +1168,7 @@
         // This method gets called a *lot, so we try to be efficient.
         String name = md.getName();
 
-        MethodDescriptor old = (MethodDescriptor)methods.get(name);
+        MethodDescriptor old = methods.get(name);
         if (old == null) {
             // This is the common case.
             methods.put(name, md);
@@ -1198,7 +1201,7 @@
         // This is very rare.
 
         String longKey = makeQualifiedMethodName(name, p1);
-        old = (MethodDescriptor)methods.get(longKey);
+        old = methods.get(longKey);
         if (old == null) {
             methods.put(longKey, md);
             return;
@@ -1269,7 +1272,7 @@
     /*
      * Internal method to return *public* methods within a class.
      */
-    private static Method[] getPublicDeclaredMethods(Class clz) {
+    private static Method[] getPublicDeclaredMethods(Class<?> clz) {
         // Looking up Class.getDeclaredMethods is relatively expensive,
         // so we cache the results.
         if (!ReflectUtil.isPackageAccessible(clz)) {
@@ -1299,14 +1302,14 @@
      * Internal support for finding a target methodName with a given
      * parameter list on a given class.
      */
-    private static Method internalFindMethod(Class start, String methodName,
+    private static Method internalFindMethod(Class<?> start, String methodName,
                                                  int argCount, Class args[]) {
         // For overriden methods we need to find the most derived version.
         // So we start with the given class and walk up the superclass chain.
 
         Method method = null;
 
-        for (Class cl = start; cl != null; cl = cl.getSuperclass()) {
+        for (Class<?> cl = start; cl != null; cl = cl.getSuperclass()) {
             Method methods[] = getPublicDeclaredMethods(cl);
             for (int i = 0; i < methods.length; i++) {
                 method = methods[i];
@@ -1357,7 +1360,7 @@
     /**
      * Find a target methodName on a given class.
      */
-    static Method findMethod(Class cls, String methodName, int argCount) {
+    static Method findMethod(Class<?> cls, String methodName, int argCount) {
         return findMethod(cls, methodName, argCount, null);
     }
 
@@ -1373,7 +1376,7 @@
      * @param args Array of argument types for the method.
      * @return the method or null if not found
      */
-    static Method findMethod(Class cls, String methodName, int argCount,
+    static Method findMethod(Class<?> cls, String methodName, int argCount,
                              Class args[]) {
         if (methodName == null) {
             return null;
@@ -1387,7 +1390,7 @@
      * or "implements" b.
      * Note tht either or both "Class" objects may represent interfaces.
      */
-    static  boolean isSubclass(Class a, Class b) {
+    static  boolean isSubclass(Class<?> a, Class<?> b) {
         // We rely on the fact that for any given java class or
         // primtitive type there is a unqiue Class object, so
         // we can use object equivalence in the comparisons.
@@ -1397,12 +1400,12 @@
         if (a == null || b == null) {
             return false;
         }
-        for (Class x = a; x != null; x = x.getSuperclass()) {
+        for (Class<?> x = a; x != null; x = x.getSuperclass()) {
             if (x == b) {
                 return true;
             }
             if (b.isInterface()) {
-                Class interfaces[] = x.getInterfaces();
+                Class<?>[] interfaces = x.getInterfaces();
                 for (int i = 0; i < interfaces.length; i++) {
                     if (isSubclass(interfaces[i], b)) {
                         return true;
@@ -1416,7 +1419,7 @@
     /**
      * Return true iff the given method throws the given exception.
      */
-    private boolean throwsException(Method method, Class exception) {
+    private boolean throwsException(Method method, Class<?> exception) {
         Class exs[] = method.getExceptionTypes();
         for (int i = 0; i < exs.length; i++) {
             if (exs[i] == exception) {
@@ -1442,12 +1445,12 @@
      * First try the classloader of "sibling", then try the system
      * classloader then the class loader of the current Thread.
      */
-    static Object instantiate(Class sibling, String className)
+    static Object instantiate(Class<?> sibling, String className)
                  throws InstantiationException, IllegalAccessException,
                                                 ClassNotFoundException {
         // First check with sibling's classloader (if any).
         ClassLoader cl = sibling.getClassLoader();
-        Class cls = ClassFinder.findClass(className, cl);
+        Class<?> cls = ClassFinder.findClass(className, cl);
         return cls.newInstance();
     }
 
@@ -1482,7 +1485,7 @@
         this.properties = properties;
         this.defaultProperty = defaultProperty;
         this.methods = methods;
-        this.targetBeanInfoRef = new SoftReference<BeanInfo>(targetBeanInfo);
+        this.targetBeanInfoRef = new SoftReference<>(targetBeanInfo);
     }
 
     /**
--- a/jdk/src/share/classes/java/beans/MetaData.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/MetaData.java	Thu Dec 01 18:34:23 2011 +0000
@@ -93,7 +93,7 @@
     }
 
     protected Expression instantiate(Object oldInstance, Encoder out) {
-        Enum e = (Enum) oldInstance;
+        Enum<?> e = (Enum<?>) oldInstance;
         return new Expression(e, Enum.class, "valueOf", new Object[]{e.getDeclaringClass(), e.name()});
     }
 }
@@ -118,7 +118,7 @@
 
     protected Expression instantiate(Object oldInstance, Encoder out) {
         // System.out.println("instantiate: " + type + " " + oldInstance);
-        Class oldClass = oldInstance.getClass();
+        Class<?> oldClass = oldInstance.getClass();
         return new Expression(oldInstance, Array.class, "newInstance",
                    new Object[]{oldClass.getComponentType(),
                                 new Integer(Array.getLength(oldInstance))});
@@ -152,14 +152,14 @@
 
 class ProxyPersistenceDelegate extends PersistenceDelegate {
     protected Expression instantiate(Object oldInstance, Encoder out) {
-        Class type = oldInstance.getClass();
+        Class<?> type = oldInstance.getClass();
         java.lang.reflect.Proxy p = (java.lang.reflect.Proxy)oldInstance;
         // This unappealing hack is not required but makes the
         // representation of EventHandlers much more concise.
         java.lang.reflect.InvocationHandler ih = java.lang.reflect.Proxy.getInvocationHandler(p);
         if (ih instanceof EventHandler) {
             EventHandler eh = (EventHandler)ih;
-            Vector args = new Vector();
+            Vector<Object> args = new Vector<>();
             args.add(type.getInterfaces()[0]);
             args.add(eh.getTarget());
             args.add(eh.getAction());
@@ -200,7 +200,7 @@
     }
 
     protected Expression instantiate(Object oldInstance, Encoder out) {
-        Class c = (Class)oldInstance;
+        Class<?> c = (Class)oldInstance;
         // As of 1.3 it is not possible to call Class.forName("int"),
         // so we have to generate different code for primitive types.
         // This is needed for arrays whose subtype may be primitive.
@@ -362,8 +362,8 @@
         if ((oldInstance instanceof List) || (oldInstance instanceof Set) || (oldInstance instanceof Map)) {
             return oldInstance.equals(newInstance);
         }
-        Collection oldC = (Collection) oldInstance;
-        Collection newC = (Collection) newInstance;
+        Collection<?> oldC = (Collection<?>) oldInstance;
+        Collection<?> newC = (Collection<?>) newInstance;
         return (oldC.size() == newC.size()) && oldC.containsAll(newC);
     }
 
@@ -387,21 +387,21 @@
 
     static final class SingletonList_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
-            List list = (List) oldInstance;
+            List<?> list = (List<?>) oldInstance;
             return new Expression(oldInstance, Collections.class, "singletonList", new Object[]{list.get(0)});
         }
     }
 
     static final class SingletonSet_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
-            Set set = (Set) oldInstance;
+            Set<?> set = (Set<?>) oldInstance;
             return new Expression(oldInstance, Collections.class, "singleton", new Object[]{set.iterator().next()});
         }
     }
 
     static final class SingletonMap_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
-            Map map = (Map) oldInstance;
+            Map<?,?> map = (Map<?,?>) oldInstance;
             Object key = map.keySet().iterator().next();
             return new Expression(oldInstance, Collections.class, "singletonMap", new Object[]{key, map.get(key)});
         }
@@ -409,98 +409,98 @@
 
     static final class UnmodifiableCollection_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
-            List list = new ArrayList((Collection) oldInstance);
+            List<?> list = new ArrayList<>((Collection<?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "unmodifiableCollection", new Object[]{list});
         }
     }
 
     static final class UnmodifiableList_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
-            List list = new LinkedList((Collection) oldInstance);
+            List<?> list = new LinkedList<>((Collection<?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "unmodifiableList", new Object[]{list});
         }
     }
 
     static final class UnmodifiableRandomAccessList_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
-            List list = new ArrayList((Collection) oldInstance);
+            List<?> list = new ArrayList<>((Collection<?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "unmodifiableList", new Object[]{list});
         }
     }
 
     static final class UnmodifiableSet_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
-            Set set = new HashSet((Set) oldInstance);
+            Set<?> set = new HashSet<>((Set<?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "unmodifiableSet", new Object[]{set});
         }
     }
 
     static final class UnmodifiableSortedSet_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
-            SortedSet set = new TreeSet((SortedSet) oldInstance);
+            SortedSet<?> set = new TreeSet<>((SortedSet<?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "unmodifiableSortedSet", new Object[]{set});
         }
     }
 
     static final class UnmodifiableMap_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
-            Map map = new HashMap((Map) oldInstance);
+            Map<?,?> map = new HashMap<>((Map<?,?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "unmodifiableMap", new Object[]{map});
         }
     }
 
     static final class UnmodifiableSortedMap_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
-            SortedMap map = new TreeMap((SortedMap) oldInstance);
+            SortedMap<?,?> map = new TreeMap<>((SortedMap<?,?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "unmodifiableSortedMap", new Object[]{map});
         }
     }
 
     static final class SynchronizedCollection_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
-            List list = new ArrayList((Collection) oldInstance);
+            List<?> list = new ArrayList<>((Collection<?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "synchronizedCollection", new Object[]{list});
         }
     }
 
     static final class SynchronizedList_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
-            List list = new LinkedList((Collection) oldInstance);
+            List<?> list = new LinkedList<>((Collection<?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "synchronizedList", new Object[]{list});
         }
     }
 
     static final class SynchronizedRandomAccessList_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
-            List list = new ArrayList((Collection) oldInstance);
+            List<?> list = new ArrayList<>((Collection<?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "synchronizedList", new Object[]{list});
         }
     }
 
     static final class SynchronizedSet_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
-            Set set = new HashSet((Set) oldInstance);
+            Set<?> set = new HashSet<>((Set<?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "synchronizedSet", new Object[]{set});
         }
     }
 
     static final class SynchronizedSortedSet_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
-            SortedSet set = new TreeSet((SortedSet) oldInstance);
+            SortedSet<?> set = new TreeSet<>((SortedSet<?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "synchronizedSortedSet", new Object[]{set});
         }
     }
 
     static final class SynchronizedMap_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
-            Map map = new HashMap((Map) oldInstance);
+            Map<?,?> map = new HashMap<>((Map<?,?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "synchronizedMap", new Object[]{map});
         }
     }
 
     static final class SynchronizedSortedMap_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
-            SortedMap map = new TreeMap((SortedMap) oldInstance);
+            SortedMap<?,?> map = new TreeMap<>((SortedMap<?,?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "synchronizedSortedMap", new Object[]{map});
         }
     }
@@ -508,7 +508,7 @@
     static final class CheckedCollection_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
             Object type = MetaData.getPrivateFieldValue(oldInstance, "java.util.Collections$CheckedCollection.type");
-            List list = new ArrayList((Collection) oldInstance);
+            List<?> list = new ArrayList<>((Collection<?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "checkedCollection", new Object[]{list, type});
         }
     }
@@ -516,7 +516,7 @@
     static final class CheckedList_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
             Object type = MetaData.getPrivateFieldValue(oldInstance, "java.util.Collections$CheckedCollection.type");
-            List list = new LinkedList((Collection) oldInstance);
+            List<?> list = new LinkedList<>((Collection<?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "checkedList", new Object[]{list, type});
         }
     }
@@ -524,7 +524,7 @@
     static final class CheckedRandomAccessList_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
             Object type = MetaData.getPrivateFieldValue(oldInstance, "java.util.Collections$CheckedCollection.type");
-            List list = new ArrayList((Collection) oldInstance);
+            List<?> list = new ArrayList<>((Collection<?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "checkedList", new Object[]{list, type});
         }
     }
@@ -532,7 +532,7 @@
     static final class CheckedSet_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
             Object type = MetaData.getPrivateFieldValue(oldInstance, "java.util.Collections$CheckedCollection.type");
-            Set set = new HashSet((Set) oldInstance);
+            Set<?> set = new HashSet<>((Set<?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "checkedSet", new Object[]{set, type});
         }
     }
@@ -540,7 +540,7 @@
     static final class CheckedSortedSet_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
             Object type = MetaData.getPrivateFieldValue(oldInstance, "java.util.Collections$CheckedCollection.type");
-            SortedSet set = new TreeSet((SortedSet) oldInstance);
+            SortedSet<?> set = new TreeSet<>((SortedSet<?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "checkedSortedSet", new Object[]{set, type});
         }
     }
@@ -549,7 +549,7 @@
         protected Expression instantiate(Object oldInstance, Encoder out) {
             Object keyType   = MetaData.getPrivateFieldValue(oldInstance, "java.util.Collections$CheckedMap.keyType");
             Object valueType = MetaData.getPrivateFieldValue(oldInstance, "java.util.Collections$CheckedMap.valueType");
-            Map map = new HashMap((Map) oldInstance);
+            Map<?,?> map = new HashMap<>((Map<?,?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "checkedMap", new Object[]{map, keyType, valueType});
         }
     }
@@ -558,7 +558,7 @@
         protected Expression instantiate(Object oldInstance, Encoder out) {
             Object keyType   = MetaData.getPrivateFieldValue(oldInstance, "java.util.Collections$CheckedMap.keyType");
             Object valueType = MetaData.getPrivateFieldValue(oldInstance, "java.util.Collections$CheckedMap.valueType");
-            SortedMap map = new TreeMap((SortedMap) oldInstance);
+            SortedMap<?,?> map = new TreeMap<>((SortedMap<?,?>) oldInstance);
             return new Expression(oldInstance, Collections.class, "checkedSortedMap", new Object[]{map, keyType, valueType});
         }
     }
@@ -605,13 +605,13 @@
 // Collection
 class java_util_Collection_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
-        java.util.Collection oldO = (java.util.Collection)oldInstance;
-        java.util.Collection newO = (java.util.Collection)newInstance;
+        java.util.Collection<?> oldO = (java.util.Collection)oldInstance;
+        java.util.Collection<?> newO = (java.util.Collection)newInstance;
 
         if (newO.size() != 0) {
             invokeStatement(oldInstance, "clear", new Object[]{}, out);
         }
-        for (Iterator i = oldO.iterator(); i.hasNext();) {
+        for (Iterator<?> i = oldO.iterator(); i.hasNext();) {
             invokeStatement(oldInstance, "add", new Object[]{i.next()}, out);
         }
     }
@@ -620,8 +620,8 @@
 // List
 class java_util_List_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
-        java.util.List oldO = (java.util.List)oldInstance;
-        java.util.List newO = (java.util.List)newInstance;
+        java.util.List<?> oldO = (java.util.List<?>)oldInstance;
+        java.util.List<?> newO = (java.util.List<?>)newInstance;
         int oldSize = oldO.size();
         int newSize = (newO == null) ? 0 : newO.size();
         if (oldSize < newSize) {
@@ -656,8 +656,8 @@
 class java_util_Map_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
         // System.out.println("Initializing: " + newInstance);
-        java.util.Map oldMap = (java.util.Map)oldInstance;
-        java.util.Map newMap = (java.util.Map)newInstance;
+        java.util.Map<?,?> oldMap = (java.util.Map)oldInstance;
+        java.util.Map<?,?> newMap = (java.util.Map)newInstance;
         // Remove the new elements.
         // Do this first otherwise we undo the adding work.
         if (newMap != null) {
@@ -746,9 +746,9 @@
         int style = Font.PLAIN;
         int size = 12;
 
-        Map basic = font.getAttributes();
-        Map clone = new HashMap(basic.size());
-        for (Object key : basic.keySet()) {
+        Map<TextAttribute, ?> basic = font.getAttributes();
+        Map<TextAttribute, Object> clone = new HashMap<>(basic.size());
+        for (TextAttribute key : basic.keySet()) {
             Object value = basic.get(key);
             if (value != null) {
                 clone.put(key, value);
@@ -784,7 +784,7 @@
                 }
             }
         }
-        Class type = font.getClass();
+        Class<?> type = font.getClass();
         if (count == clone.size()) {
             return new Expression(font, type, "new", new Object[]{family, style, size});
         }
@@ -832,7 +832,7 @@
         if (args == null) {
             throw new IllegalStateException("Unsupported KeyStroke: " + key);
         }
-        Class type = key.getClass();
+        Class<?> type = key.getClass();
         String name = type.getName();
         // get short name of the class
         int index = name.lastIndexOf('.') + 1;
@@ -1057,12 +1057,12 @@
     protected void initialize(Class<?> type, Object oldInstance,
                               Object newInstance, Encoder out) {
         super.initialize(type, oldInstance, newInstance, out);
-        Hashtable tab = (Hashtable)ReflectionUtils.getPrivateField(oldInstance,
+        Hashtable<?,?> tab = (Hashtable<?,?>)ReflectionUtils.getPrivateField(oldInstance,
                                                                    java.awt.CardLayout.class,
                                                                    "tab",
                                                                    out.getExceptionListener());
         if (tab != null) {
-            for(Enumeration e = tab.keys(); e.hasMoreElements();) {
+            for(Enumeration<?> e = tab.keys(); e.hasMoreElements();) {
                 Object child = e.nextElement();
                 invokeStatement(oldInstance, "addLayoutComponent",
                                 new Object[]{child, (String)tab.get(child)}, out);
@@ -1076,12 +1076,12 @@
     protected void initialize(Class<?> type, Object oldInstance,
                               Object newInstance, Encoder out) {
         super.initialize(type, oldInstance, newInstance, out);
-        Hashtable comptable = (Hashtable)ReflectionUtils.getPrivateField(oldInstance,
+        Hashtable<?,?> comptable = (Hashtable<?,?>)ReflectionUtils.getPrivateField(oldInstance,
                                                  java.awt.GridBagLayout.class,
                                                  "comptable",
                                                  out.getExceptionListener());
         if (comptable != null) {
-            for(Enumeration e = comptable.keys(); e.hasMoreElements();) {
+            for(Enumeration<?> e = comptable.keys(); e.hasMoreElements();) {
                 Object child = e.nextElement();
                 invokeStatement(oldInstance, "addLayoutComponent",
                                 new Object[]{child, comptable.get(child)}, out);
@@ -1119,8 +1119,8 @@
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
         // Note, the "size" property will be set here.
         super.initialize(type, oldInstance, newInstance, out);
-        javax.swing.DefaultListModel m = (javax.swing.DefaultListModel)oldInstance;
-        javax.swing.DefaultListModel n = (javax.swing.DefaultListModel)newInstance;
+        javax.swing.DefaultListModel<?> m = (javax.swing.DefaultListModel<?>)oldInstance;
+        javax.swing.DefaultListModel<?> n = (javax.swing.DefaultListModel<?>)newInstance;
         for (int i = n.getSize(); i < m.getSize(); i++) {
             invokeStatement(oldInstance, "add", // Can also use "addElement".
                     new Object[]{m.getElementAt(i)}, out);
@@ -1132,7 +1132,7 @@
 class javax_swing_DefaultComboBoxModel_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
         super.initialize(type, oldInstance, newInstance, out);
-        javax.swing.DefaultComboBoxModel m = (javax.swing.DefaultComboBoxModel)oldInstance;
+        javax.swing.DefaultComboBoxModel<?> m = (javax.swing.DefaultComboBoxModel<?>)oldInstance;
         for (int i = 0; i < m.getSize(); i++) {
             invokeStatement(oldInstance, "addElement", new Object[]{m.getElementAt(i)}, out);
         }
@@ -1275,7 +1275,7 @@
 
 class MetaData {
     private static final Map<String,Field> fields = Collections.synchronizedMap(new WeakHashMap<String, Field>());
-    private static Hashtable internalPersistenceDelegates = new Hashtable();
+    private static Hashtable<String, PersistenceDelegate> internalPersistenceDelegates = new Hashtable<>();
 
     private static PersistenceDelegate nullPersistenceDelegate = new NullPersistenceDelegate();
     private static PersistenceDelegate enumPersistenceDelegate = new EnumPersistenceDelegate();
@@ -1308,6 +1308,7 @@
         internalPersistenceDelegates.put("java.util.RegularEnumSet", new java_util_EnumSet_PersistenceDelegate());
     }
 
+    @SuppressWarnings("rawtypes")
     public synchronized static PersistenceDelegate getPersistenceDelegate(Class type) {
         if (type == null) {
             return nullPersistenceDelegate;
@@ -1342,7 +1343,7 @@
         String typeName = type.getName();
         PersistenceDelegate pd = (PersistenceDelegate)getBeanAttribute(type, "persistenceDelegate");
         if (pd == null) {
-            pd = (PersistenceDelegate)internalPersistenceDelegates.get(typeName);
+            pd = internalPersistenceDelegates.get(typeName);
             if (pd != null) {
                 return pd;
             }
@@ -1369,7 +1370,7 @@
         return (pd != null) ? pd : defaultPersistenceDelegate;
     }
 
-    private static String[] getConstructorProperties(Class type) {
+    private static String[] getConstructorProperties(Class<?> type) {
         String[] names = null;
         int length = 0;
         for (Constructor<?> constructor : type.getConstructors()) {
@@ -1402,7 +1403,7 @@
         return true;
     }
 
-    private static Object getBeanAttribute(Class type, String attribute) {
+    private static Object getBeanAttribute(Class<?> type, String attribute) {
         try {
             return Introspector.getBeanInfo(type).getBeanDescriptor().getValue(attribute);
         } catch (IntrospectionException exception) {
--- a/jdk/src/share/classes/java/beans/MethodDescriptor.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/MethodDescriptor.java	Thu Dec 01 18:34:23 2011 +0000
@@ -42,7 +42,7 @@
 
     private String[] paramNames;
 
-    private List params;
+    private List<WeakReference<Class<?>>> params;
 
     private ParameterDescriptor parameterDescriptors[];
 
@@ -81,10 +81,10 @@
     public synchronized Method getMethod() {
         Method method = getMethod0();
         if (method == null) {
-            Class cls = getClass0();
+            Class<?> cls = getClass0();
             String name = getName();
             if ((cls != null) && (name != null)) {
-                Class[] params = getParams();
+                Class<?>[] params = getParams();
                 if (params == null) {
                     for (int i = 0; i < 3; i++) {
                         // Find methods for up to 2 params. We are guessing here.
@@ -121,15 +121,15 @@
                 : null;
     }
 
-    private synchronized void setParams(Class[] param) {
+    private synchronized void setParams(Class<?>[] param) {
         if (param == null) {
             return;
         }
         paramNames = new String[param.length];
-        params = new ArrayList(param.length);
+        params = new ArrayList<>(param.length);
         for (int i = 0; i < param.length; i++) {
             paramNames[i] = param[i].getName();
-            params.add(new WeakReference(param[i]));
+            params.add(new WeakReference<Class<?>>(param[i]));
         }
     }
 
@@ -138,12 +138,12 @@
         return paramNames;
     }
 
-    private synchronized Class[] getParams() {
-        Class[] clss = new Class[params.size()];
+    private synchronized Class<?>[] getParams() {
+        Class<?>[] clss = new Class<?>[params.size()];
 
         for (int i = 0; i < params.size(); i++) {
-            Reference ref = (Reference)params.get(i);
-            Class cls = (Class)ref.get();
+            Reference<? extends Class<?>> ref = (Reference<? extends Class<?>>)params.get(i);
+            Class<?> cls = ref.get();
             if (cls == null) {
                 return null;
             } else {
--- a/jdk/src/share/classes/java/beans/NameGenerator.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/NameGenerator.java	Thu Dec 01 18:34:23 2011 +0000
@@ -43,12 +43,12 @@
  */
 class NameGenerator {
 
-    private Map valueToName;
-    private Map nameToCount;
+    private Map<Object, String> valueToName;
+    private Map<String, Integer> nameToCount;
 
     public NameGenerator() {
-        valueToName = new IdentityHashMap();
-        nameToCount = new HashMap();
+        valueToName = new IdentityHashMap<>();
+        nameToCount = new HashMap<>();
     }
 
     /**
@@ -63,6 +63,7 @@
     /**
      * Returns the root name of the class.
      */
+    @SuppressWarnings("rawtypes")
     public static String unqualifiedClassName(Class type) {
         if (type.isArray()) {
             return unqualifiedClassName(type.getComponentType())+"Array";
@@ -97,15 +98,15 @@
             return unqualifiedClassName((Class)instance);
         }
         else {
-            String result = (String)valueToName.get(instance);
+            String result = valueToName.get(instance);
             if (result != null) {
                 return result;
             }
-            Class type = instance.getClass();
+            Class<?> type = instance.getClass();
             String className = unqualifiedClassName(type);
 
-            Object size = nameToCount.get(className);
-            int instanceNumber = (size == null) ? 0 : ((Integer)size).intValue() + 1;
+            Integer size = nameToCount.get(className);
+            int instanceNumber = (size == null) ? 0 : (size).intValue() + 1;
             nameToCount.put(className, new Integer(instanceNumber));
 
             result = className + instanceNumber;
--- a/jdk/src/share/classes/java/beans/PersistenceDelegate.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/PersistenceDelegate.java	Thu Dec 01 18:34:23 2011 +0000
@@ -207,7 +207,7 @@
                               Object oldInstance, Object newInstance,
                               Encoder out)
     {
-        Class superType = type.getSuperclass();
+        Class<?> superType = type.getSuperclass();
         PersistenceDelegate info = out.getPersistenceDelegate(superType);
         info.initialize(superType, oldInstance, newInstance, out);
     }
--- a/jdk/src/share/classes/java/beans/PropertyChangeSupport.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/PropertyChangeSupport.java	Thu Dec 01 18:34:23 2011 +0000
@@ -431,7 +431,7 @@
                     listeners = entry.getValue();
                 } else {
                     if (children == null) {
-                        children = new Hashtable<String, PropertyChangeSupport>();
+                        children = new Hashtable<>();
                     }
                     PropertyChangeSupport pcs = new PropertyChangeSupport(this.source);
                     pcs.map.set(null, entry.getValue());
@@ -460,6 +460,7 @@
 
         ObjectInputStream.GetField fields = s.readFields();
 
+        @SuppressWarnings("unchecked")
         Hashtable<String, PropertyChangeSupport> children = (Hashtable<String, PropertyChangeSupport>) fields.get("children", null);
         this.source = fields.get("source", null);
         fields.get("propertyChangeSupportSerializedDataVersion", 2);
--- a/jdk/src/share/classes/java/beans/PropertyDescriptor.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/PropertyDescriptor.java	Thu Dec 01 18:34:23 2011 +0000
@@ -35,10 +35,10 @@
  */
 public class PropertyDescriptor extends FeatureDescriptor {
 
-    private Reference<Class> propertyTypeRef;
+    private Reference<? extends Class<?>> propertyTypeRef;
     private Reference<Method> readMethodRef;
     private Reference<Method> writeMethodRef;
-    private Reference<Class> propertyEditorClassRef;
+    private Reference<? extends Class<?>> propertyEditorClassRef;
 
     private boolean bound;
     private boolean constrained;
@@ -174,7 +174,7 @@
      *         or {@code null} if the type cannot be determined
      */
     public synchronized Class<?> getPropertyType() {
-        Class type = getPropertyType0();
+        Class<?> type = getPropertyType0();
         if (type  == null) {
             try {
                 type = findPropertyType(getReadMethod(), getWriteMethod());
@@ -186,11 +186,11 @@
         return type;
     }
 
-    private void setPropertyType(Class type) {
+    private void setPropertyType(Class<?> type) {
         this.propertyTypeRef = getWeakReference(type);
     }
 
-    private Class getPropertyType0() {
+    private Class<?> getPropertyType0() {
         return (this.propertyTypeRef != null)
                 ? this.propertyTypeRef.get()
                 : null;
@@ -205,13 +205,13 @@
     public synchronized Method getReadMethod() {
         Method readMethod = getReadMethod0();
         if (readMethod == null) {
-            Class cls = getClass0();
+            Class<?> cls = getClass0();
             if (cls == null || (readMethodName == null && readMethodRef == null)) {
                 // The read method was explicitly set to null.
                 return null;
             }
             if (readMethodName == null) {
-                Class type = getPropertyType0();
+                Class<?> type = getPropertyType0();
                 if (type == boolean.class || type == null) {
                     readMethodName = Introspector.IS_PREFIX + getBaseName();
                 } else {
@@ -268,14 +268,14 @@
     public synchronized Method getWriteMethod() {
         Method writeMethod = getWriteMethod0();
         if (writeMethod == null) {
-            Class cls = getClass0();
+            Class<?> cls = getClass0();
             if (cls == null || (writeMethodName == null && writeMethodRef == null)) {
                 // The write method was explicitly set to null.
                 return null;
             }
 
             // We need the type to fetch the correct method.
-            Class type = getPropertyType0();
+            Class<?> type = getPropertyType0();
             if (type == null) {
                 try {
                     // Can't use getPropertyType since it will lead to recursive loop.
@@ -292,7 +292,7 @@
                 writeMethodName = Introspector.SET_PREFIX + getBaseName();
             }
 
-            Class[] args = (type == null) ? null : new Class[] { type };
+            Class<?>[] args = (type == null) ? null : new Class<?>[] { type };
             writeMethod = Introspector.findMethod(cls, writeMethodName, 1, args);
             if (writeMethod != null) {
                 if (!writeMethod.getReturnType().equals(void.class)) {
@@ -344,7 +344,7 @@
     /**
      * Overridden to ensure that a super class doesn't take precedent
      */
-    void setClass0(Class clz) {
+    void setClass0(Class<?> clz) {
         if (getClass0() != null && clz.isAssignableFrom(getClass0())) {
             // dont replace a subclass with a superclass
             return;
@@ -402,7 +402,7 @@
      * @param propertyEditorClass  The Class for the desired PropertyEditor.
      */
     public void setPropertyEditorClass(Class<?> propertyEditorClass) {
-        this.propertyEditorClassRef = getWeakReference((Class)propertyEditorClass);
+        this.propertyEditorClassRef = getWeakReference(propertyEditorClass);
     }
 
     /**
@@ -437,12 +437,12 @@
     public PropertyEditor createPropertyEditor(Object bean) {
         Object editor = null;
 
-        Class cls = getPropertyEditorClass();
+        Class<?> cls = getPropertyEditorClass();
         if (cls != null) {
-            Constructor ctor = null;
+            Constructor<?> ctor = null;
             if (bean != null) {
                 try {
-                    ctor = cls.getConstructor(new Class[] { Object.class });
+                    ctor = cls.getConstructor(new Class<?>[] { Object.class });
                 } catch (Exception ex) {
                     // Fall through
                 }
@@ -637,12 +637,12 @@
      *         read and write methods are null.
      * @throws IntrospectionException if the read or write method is invalid
      */
-    private Class findPropertyType(Method readMethod, Method writeMethod)
+    private Class<?> findPropertyType(Method readMethod, Method writeMethod)
         throws IntrospectionException {
-        Class propertyType = null;
+        Class<?> propertyType = null;
         try {
             if (readMethod != null) {
-                Class[] params = getParameterTypes(getClass0(), readMethod);
+                Class<?>[] params = getParameterTypes(getClass0(), readMethod);
                 if (params.length != 0) {
                     throw new IntrospectionException("bad read method arg count: "
                                                      + readMethod);
@@ -654,7 +654,7 @@
                 }
             }
             if (writeMethod != null) {
-                Class params[] = getParameterTypes(getClass0(), writeMethod);
+                Class<?>[] params = getParameterTypes(getClass0(), writeMethod);
                 if (params.length != 1) {
                     throw new IntrospectionException("bad write method arg count: "
                                                      + writeMethod);
--- a/jdk/src/share/classes/java/beans/PropertyEditorSupport.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/PropertyEditorSupport.java	Thu Dec 01 18:34:23 2011 +0000
@@ -251,7 +251,7 @@
     public synchronized void addPropertyChangeListener(
                                 PropertyChangeListener listener) {
         if (listeners == null) {
-            listeners = new java.util.Vector();
+            listeners = new java.util.Vector<>();
         }
         listeners.addElement(listener);
     }
@@ -278,25 +278,30 @@
      * Report that we have been modified to any interested listeners.
      */
     public void firePropertyChange() {
-        java.util.Vector targets;
+        java.util.Vector<PropertyChangeListener> targets;
         synchronized (this) {
             if (listeners == null) {
                 return;
             }
-            targets = (java.util.Vector) listeners.clone();
+            targets = unsafeClone(listeners);
         }
         // Tell our listeners that "everything" has changed.
         PropertyChangeEvent evt = new PropertyChangeEvent(source, null, null, null);
 
         for (int i = 0; i < targets.size(); i++) {
-            PropertyChangeListener target = (PropertyChangeListener)targets.elementAt(i);
+            PropertyChangeListener target = targets.elementAt(i);
             target.propertyChange(evt);
         }
     }
 
+    @SuppressWarnings("unchecked")
+    private <T> java.util.Vector<T> unsafeClone(java.util.Vector<T> v) {
+        return (java.util.Vector<T>)v.clone();
+    }
+
     //----------------------------------------------------------------------
 
     private Object value;
     private Object source;
-    private java.util.Vector listeners;
+    private java.util.Vector<PropertyChangeListener> listeners;
 }
--- a/jdk/src/share/classes/java/beans/ReflectionUtils.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/ReflectionUtils.java	Thu Dec 01 18:34:23 2011 +0000
@@ -32,10 +32,12 @@
  */
 class ReflectionUtils {
 
+    @SuppressWarnings("rawtypes")
     public static boolean isPrimitive(Class type) {
         return primitiveTypeFor(type) != null;
     }
 
+    @SuppressWarnings("rawtypes")
     public static Class primitiveTypeFor(Class wrapper) {
         if (wrapper == Boolean.class) return Boolean.TYPE;
         if (wrapper == Byte.class) return Byte.TYPE;
@@ -58,6 +60,7 @@
      * @param el an exception listener to handle exceptions; or null
      * @return value of the field; null if not found or an error is encountered
      */
+    @SuppressWarnings("rawtypes")
     public static Object getPrivateField(Object instance, Class cls,
                                          String name, ExceptionListener el) {
         try {
--- a/jdk/src/share/classes/java/beans/SimpleBeanInfo.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/SimpleBeanInfo.java	Thu Dec 01 18:34:23 2011 +0000
@@ -116,10 +116,10 @@
      */
     public java.awt.Image loadImage(final String resourceName) {
         try {
-            final Class c = getClass();
+            final Class<?> c = getClass();
             java.awt.image.ImageProducer ip = (java.awt.image.ImageProducer)
                 java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedAction() {
+                new java.security.PrivilegedAction<Object>() {
                     public Object run() {
                         java.net.URL url;
                         if ((url = c.getResource(resourceName)) == null) {
--- a/jdk/src/share/classes/java/beans/Statement.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/Statement.java	Thu Dec 01 18:34:23 2011 +0000
@@ -212,7 +212,7 @@
         if (target == Class.class && methodName.equals("forName")) {
             return ClassFinder.resolveClass((String)arguments[0], this.loader);
         }
-        Class[] argClasses = new Class[arguments.length];
+        Class<?>[] argClasses = new Class<?>[arguments.length];
         for(int i = 0; i < arguments.length; i++) {
             argClasses[i] = (arguments[i] == null) ? null : arguments[i].getClass();
         }
--- a/jdk/src/share/classes/java/beans/VetoableChangeSupport.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/VetoableChangeSupport.java	Thu Dec 01 18:34:23 2011 +0000
@@ -420,7 +420,7 @@
                     listeners = entry.getValue();
                 } else {
                     if (children == null) {
-                        children = new Hashtable<String, VetoableChangeSupport>();
+                        children = new Hashtable<>();
                     }
                     VetoableChangeSupport vcs = new VetoableChangeSupport(this.source);
                     vcs.map.set(null, entry.getValue());
@@ -449,7 +449,8 @@
 
         ObjectInputStream.GetField fields = s.readFields();
 
-        Hashtable<String, VetoableChangeSupport> children = (Hashtable<String, VetoableChangeSupport>) fields.get("children", null);
+        @SuppressWarnings("unchecked")
+        Hashtable<String, VetoableChangeSupport> children = (Hashtable<String, VetoableChangeSupport>)fields.get("children", null);
         this.source = fields.get("source", null);
         fields.get("vetoableChangeSupportSerializedDataVersion", 2);
 
--- a/jdk/src/share/classes/java/beans/XMLEncoder.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/XMLEncoder.java	Thu Dec 01 18:34:23 2011 +0000
@@ -287,8 +287,8 @@
         this.declaration = declaration;
         this.indentation = indentation;
         this.out = new OutputStreamWriter(out, cs.newEncoder());
-        valueToExpression = new IdentityHashMap<Object, ValueData>();
-        targetToStatementList = new IdentityHashMap<Object, List<Statement>>();
+        valueToExpression = new IdentityHashMap<>();
+        targetToStatementList = new IdentityHashMap<>();
         nameGenerator = new NameGenerator();
     }
 
@@ -334,7 +334,7 @@
     private List<Statement> statementList(Object target) {
         List<Statement> list = targetToStatementList.get(target);
         if (list == null) {
-            list = new ArrayList<Statement>();
+            list = new ArrayList<>();
             targetToStatementList.put(target, list);
         }
         return list;
@@ -604,7 +604,7 @@
                 return;
             }
 
-            Class primitiveType = ReflectionUtils.primitiveTypeFor(value.getClass());
+            Class<?> primitiveType = ReflectionUtils.primitiveTypeFor(value.getClass());
             if (primitiveType != null && target == value.getClass() &&
                 methodName.equals("new")) {
                 String primitiveTypeName = primitiveType.getName();
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContext.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContext.java	Thu Dec 01 18:34:23 2011 +0000
@@ -53,6 +53,7 @@
  * @see java.util.Collection
  */
 
+@SuppressWarnings("rawtypes")
 public interface BeanContext extends BeanContextChild, Collection, DesignMode, Visibility {
 
     /**
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextMembershipEvent.java	Thu Dec 01 11:09:54 2011 +0000
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextMembershipEvent.java	Thu Dec 01 18:34:23 2011 +0000
@@ -65,6 +65,7 @@
      * @throws NullPointerException if <CODE>changes</CODE> is <CODE>null</CODE>
      */
 
+    @SuppressWarnings("rawtypes")
     public BeanContextMembershipEvent(BeanContext bc, Collection changes) {
         super(bc);
 
@@ -117,6 +118,7 @@
      * Gets the array of children affected by this event.
      * @return the array of children effected
      */
+    @SuppressWarnings("rawtypes")
     public Iterator iterator() { return children.iterator(); }
 
     /*
@@ -127,5 +129,6 @@
     * The list of children affected by this
     * event notification.
     */
+    @SuppressWarnings("rawtypes")
     protected Collection children;
 }