8039109: Fix unchecked and raw lint warnings in java.awt
authordarcy
Mon, 05 May 2014 23:38:30 -0700
changeset 24549 147a5c8b7793
parent 24548 9c007a986347
child 24550 cc2777fafab7
8039109: Fix unchecked and raw lint warnings in java.awt Reviewed-by: pchelko, forax, flar, prr
jdk/src/share/classes/java/awt/AWTKeyStroke.java
jdk/src/share/classes/java/awt/CardLayout.java
jdk/src/share/classes/java/awt/Component.java
jdk/src/share/classes/java/awt/GraphicsEnvironment.java
jdk/src/share/classes/java/awt/KeyboardFocusManager.java
jdk/src/share/classes/java/awt/SystemTray.java
jdk/src/share/classes/java/awt/datatransfer/MimeTypeParameterList.java
jdk/src/share/classes/java/awt/dnd/DragGestureEvent.java
jdk/src/share/classes/java/awt/geom/Area.java
jdk/src/share/classes/java/awt/image/BufferedImage.java
jdk/src/share/classes/java/awt/image/CropImageFilter.java
jdk/src/share/classes/java/awt/image/FilteredImageSource.java
jdk/src/share/classes/java/awt/image/ImageFilter.java
jdk/src/share/classes/java/awt/image/MemoryImageSource.java
jdk/src/share/classes/java/awt/image/ReplicateScaleFilter.java
jdk/src/share/classes/java/awt/image/renderable/ParameterBlock.java
jdk/src/share/classes/java/awt/image/renderable/RenderableImageOp.java
jdk/src/share/classes/java/awt/image/renderable/RenderableImageProducer.java
jdk/src/share/classes/java/awt/print/Book.java
jdk/src/share/classes/java/awt/print/PrinterJob.java
--- a/jdk/src/share/classes/java/awt/AWTKeyStroke.java	Mon May 05 23:19:00 2014 -0700
+++ b/jdk/src/share/classes/java/awt/AWTKeyStroke.java	Mon May 05 23:38:30 2014 -0700
@@ -86,7 +86,8 @@
      * Must be called under locked AWTKeyStro
      */
     private static Class<AWTKeyStroke> getAWTKeyStrokeClass() {
-        Class<AWTKeyStroke> clazz = (Class)AppContext.getAppContext().get(AWTKeyStroke.class);
+        @SuppressWarnings("unchecked")
+        Class<AWTKeyStroke> clazz = (Class<AWTKeyStroke>)AppContext.getAppContext().get(AWTKeyStroke.class);
         if (clazz == null) {
             clazz = AWTKeyStroke.class;
             AppContext.getAppContext().put(AWTKeyStroke.class, AWTKeyStroke.class);
@@ -182,6 +183,7 @@
             throw new IllegalArgumentException("subclass cannot be null");
         }
         synchronized (AWTKeyStroke.class) {
+            @SuppressWarnings("unchecked")
             Class<AWTKeyStroke> keyStrokeClass = (Class)AppContext.getAppContext().get(AWTKeyStroke.class);
             if (keyStrokeClass != null && keyStrokeClass.equals(subclass)){
                 // Already registered
@@ -192,7 +194,7 @@
             throw new ClassCastException("subclass is not derived from AWTKeyStroke");
         }
 
-        Constructor ctor = getCtor(subclass);
+        Constructor<?> ctor = getCtor(subclass);
 
         String couldNotInstantiate = "subclass could not be instantiated";
 
@@ -227,12 +229,12 @@
        threat as accessible flag is set only for this Constructor object,
        not for Class constructor.
      */
-    private static Constructor getCtor(final Class clazz)
+    private static Constructor<?> getCtor(final Class<?> clazz)
     {
-        Constructor ctor = AccessController.doPrivileged(new PrivilegedAction<Constructor>() {
-            public Constructor run() {
+        Constructor<?> ctor = AccessController.doPrivileged(new PrivilegedAction<Constructor<?>>() {
+            public Constructor<?> run() {
                 try {
-                    Constructor ctor = clazz.getDeclaredConstructor((Class[]) null);
+                    Constructor<?> ctor = clazz.getDeclaredConstructor((Class<?>[]) null);
                     if (ctor != null) {
                         ctor.setAccessible(true);
                     }
@@ -249,6 +251,7 @@
     private static synchronized AWTKeyStroke getCachedStroke
         (char keyChar, int keyCode, int modifiers, boolean onKeyRelease)
     {
+        @SuppressWarnings("unchecked")
         Map<AWTKeyStroke, AWTKeyStroke> cache = (Map)AppContext.getAppContext().get(APP_CONTEXT_CACHE_KEY);
         AWTKeyStroke cacheKey = (AWTKeyStroke)AppContext.getAppContext().get(APP_CONTEXT_KEYSTROKE_KEY);
 
--- a/jdk/src/share/classes/java/awt/CardLayout.java	Mon May 05 23:19:00 2014 -0700
+++ b/jdk/src/share/classes/java/awt/CardLayout.java	Mon May 05 23:38:30 2014 -0700
@@ -560,6 +560,7 @@
     /**
      * Reads serializable fields from stream.
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream s)
         throws ClassNotFoundException, IOException
     {
--- a/jdk/src/share/classes/java/awt/Component.java	Mon May 05 23:19:00 2014 -0700
+++ b/jdk/src/share/classes/java/awt/Component.java	Mon May 05 23:38:30 2014 -0700
@@ -6184,7 +6184,7 @@
     /**
      * Parameter types of coalesceEvents(AWTEvent,AWTEVent).
      */
-    private static final Class[] coalesceEventsParams = {
+    private static final Class<?>[] coalesceEventsParams = {
         AWTEvent.class, AWTEvent.class
     };
 
--- a/jdk/src/share/classes/java/awt/GraphicsEnvironment.java	Mon May 05 23:19:00 2014 -0700
+++ b/jdk/src/share/classes/java/awt/GraphicsEnvironment.java	Mon May 05 23:38:30 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -95,18 +95,18 @@
         String nm = AccessController.doPrivileged(new GetPropertyAction("java.awt.graphicsenv", null));
         try {
 //          long t0 = System.currentTimeMillis();
-            Class<GraphicsEnvironment> geCls;
+            Class<?> geCls;
             try {
                 // First we try if the bootclassloader finds the requested
                 // class. This way we can avoid to run in a privileged block.
-                geCls = (Class<GraphicsEnvironment>)Class.forName(nm);
+                geCls = Class.forName(nm);
             } catch (ClassNotFoundException ex) {
                 // If the bootclassloader fails, we try again with the
                 // application classloader.
                 ClassLoader cl = ClassLoader.getSystemClassLoader();
-                geCls = (Class<GraphicsEnvironment>)Class.forName(nm, true, cl);
+                geCls = Class.forName(nm, true, cl);
             }
-            ge = geCls.newInstance();
+            ge = (GraphicsEnvironment)geCls.newInstance();
 //          long t1 = System.currentTimeMillis();
 //          System.out.println("GE creation took " + (t1-t0)+ "ms.");
             if (isHeadless()) {
--- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java	Mon May 05 23:19:00 2014 -0700
+++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java	Mon May 05 23:38:30 2014 -0700
@@ -348,6 +348,7 @@
      * Component of those Windows that has no such array of its own explicitly
      * set.
      */
+    @SuppressWarnings({"unchecked", "rawtypes"})
     private Set<AWTKeyStroke>[] defaultFocusTraversalKeys = new Set[4];
 
     /**
@@ -422,7 +423,7 @@
             targetSet.add(AWTKeyStroke.getAWTKeyStroke(tokens.nextToken()));
         }
         return (targetSet.isEmpty())
-            ? Collections.EMPTY_SET
+            ? Collections.emptySet()
             : Collections.unmodifiableSet(targetSet);
     }
 
@@ -436,7 +437,7 @@
                 work_set.add(defaultFocusTraversalKeyStrokes[i][j]);
             }
             defaultFocusTraversalKeys[i] = (work_set.isEmpty())
-                ? Collections.EMPTY_SET
+                ? Collections.emptySet()
                 : Collections.unmodifiableSet(work_set);
         }
         initPeer();
@@ -1750,11 +1751,12 @@
      * @see #addKeyEventDispatcher
      * @see #removeKeyEventDispatcher
      */
+    @SuppressWarnings("unchecked") // Cast of result of clone
     protected synchronized java.util.List<KeyEventDispatcher>
         getKeyEventDispatchers()
     {
         return (keyEventDispatchers != null)
-            ? (java.util.List)keyEventDispatchers.clone()
+            ? (java.util.List<KeyEventDispatcher>)keyEventDispatchers.clone()
             : null;
     }
 
@@ -1841,11 +1843,12 @@
      * @see #addKeyEventPostProcessor
      * @see #removeKeyEventPostProcessor
      */
+    @SuppressWarnings("unchecked") // Cast of result of clone
     protected java.util.List<KeyEventPostProcessor>
         getKeyEventPostProcessors()
     {
         return (keyEventPostProcessors != null)
-            ? (java.util.List)keyEventPostProcessors.clone()
+            ? (java.util.List<KeyEventPostProcessor>)keyEventPostProcessors.clone()
             : null;
     }
 
@@ -1907,8 +1910,7 @@
      * javax.swing.JComponent.runInputVerifier() using reflection.
      */
     static synchronized Component getMostRecentFocusOwner(Window window) {
-        WeakReference<Component> weakValue =
-            (WeakReference)mostRecentFocusOwners.get(window);
+        WeakReference<Component> weakValue = mostRecentFocusOwners.get(window);
         return weakValue == null ? null : weakValue.get();
     }
 
--- a/jdk/src/share/classes/java/awt/SystemTray.java	Mon May 05 23:19:00 2014 -0700
+++ b/jdk/src/share/classes/java/awt/SystemTray.java	Mon May 05 23:38:30 2014 -0700
@@ -259,7 +259,9 @@
         Vector<TrayIcon> icons = null;
         synchronized (this) {
             oldArray = systemTray.getTrayIcons();
-            icons = (Vector<TrayIcon>)AppContext.getAppContext().get(TrayIcon.class);
+            @SuppressWarnings("unchecked")
+            Vector<TrayIcon> tmp = (Vector<TrayIcon>)AppContext.getAppContext().get(TrayIcon.class);
+            icons = tmp;
             if (icons == null) {
                 icons = new Vector<TrayIcon>(3);
                 AppContext.getAppContext().put(TrayIcon.class, icons);
@@ -304,6 +306,7 @@
         TrayIcon[] oldArray = null, newArray = null;
         synchronized (this) {
             oldArray = systemTray.getTrayIcons();
+            @SuppressWarnings("unchecked")
             Vector<TrayIcon> icons = (Vector<TrayIcon>)AppContext.getAppContext().get(TrayIcon.class);
             // TrayIcon with no peer is not contained in the array.
             if (icons == null || !icons.remove(trayIcon)) {
@@ -335,6 +338,7 @@
      * @see TrayIcon
      */
     public TrayIcon[] getTrayIcons() {
+        @SuppressWarnings("unchecked")
         Vector<TrayIcon> icons = (Vector<TrayIcon>)AppContext.getAppContext().get(TrayIcon.class);
         if (icons != null) {
             return icons.toArray(new TrayIcon[icons.size()]);
--- a/jdk/src/share/classes/java/awt/datatransfer/MimeTypeParameterList.java	Mon May 05 23:19:00 2014 -0700
+++ b/jdk/src/share/classes/java/awt/datatransfer/MimeTypeParameterList.java	Mon May 05 23:38:30 2014 -0700
@@ -296,14 +296,14 @@
     /**
      * @return a clone of this object
      */
-
+    @SuppressWarnings("unchecked") // Cast from clone
      public Object clone() {
          MimeTypeParameterList newObj = null;
          try {
              newObj = (MimeTypeParameterList)super.clone();
          } catch (CloneNotSupportedException cannotHappen) {
          }
-         newObj.parameters = (Hashtable)parameters.clone();
+         newObj.parameters = (Hashtable<String, String>)parameters.clone();
          return newObj;
      }
 
--- a/jdk/src/share/classes/java/awt/dnd/DragGestureEvent.java	Mon May 05 23:19:00 2014 -0700
+++ b/jdk/src/share/classes/java/awt/dnd/DragGestureEvent.java	Mon May 05 23:38:30 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -357,6 +357,7 @@
         action = newAction;
 
         // Pre-1.4 support. 'events' was previously non-transient
+        @SuppressWarnings("rawtypes")
         List newEvents;
         try {
             newEvents = (List)f.get("events", null);
--- a/jdk/src/share/classes/java/awt/geom/Area.java	Mon May 05 23:19:00 2014 -0700
+++ b/jdk/src/share/classes/java/awt/geom/Area.java	Mon May 05 23:38:30 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -97,9 +97,9 @@
  * @since 1.2
  */
 public class Area implements Shape, Cloneable {
-    private static Vector EmptyCurves = new Vector();
+    private static Vector<Curve> EmptyCurves = new Vector<>();
 
-    private Vector curves;
+    private Vector<Curve> curves;
 
     /**
      * Default constructor which creates an empty area.
@@ -127,8 +127,8 @@
         }
     }
 
-    private static Vector pathToCurves(PathIterator pi) {
-        Vector curves = new Vector();
+    private static Vector<Curve> pathToCurves(PathIterator pi) {
+        Vector<Curve> curves = new Vector<>();
         int windingRule = pi.getWindingRule();
         // coords array is big enough for holding:
         //     coordinates returned from currentSegment (6)
@@ -334,7 +334,7 @@
      * @since 1.2
      */
     public void reset() {
-        curves = new Vector();
+        curves = new Vector<>();
         invalidateBounds();
     }
 
@@ -357,9 +357,9 @@
      * @since 1.2
      */
     public boolean isPolygonal() {
-        Enumeration enum_ = curves.elements();
+        Enumeration<Curve> enum_ = curves.elements();
         while (enum_.hasMoreElements()) {
-            if (((Curve) enum_.nextElement()).getOrder() > 1) {
+            if (enum_.nextElement().getOrder() > 1) {
                 return false;
             }
         }
@@ -381,8 +381,8 @@
         if (size > 3) {
             return false;
         }
-        Curve c1 = (Curve) curves.get(1);
-        Curve c2 = (Curve) curves.get(2);
+        Curve c1 = curves.get(1);
+        Curve c2 = curves.get(2);
         if (c1.getOrder() != 1 || c2.getOrder() != 1) {
             return false;
         }
@@ -411,10 +411,10 @@
         if (curves.size() < 3) {
             return true;
         }
-        Enumeration enum_ = curves.elements();
+        Enumeration<Curve> enum_ = curves.elements();
         enum_.nextElement(); // First Order0 "moveto"
         while (enum_.hasMoreElements()) {
-            if (((Curve) enum_.nextElement()).getOrder() == 0) {
+            if (enum_.nextElement().getOrder() == 0) {
                 return false;
             }
         }
@@ -431,11 +431,11 @@
         }
         Rectangle2D r = new Rectangle2D.Double();
         if (curves.size() > 0) {
-            Curve c = (Curve) curves.get(0);
+            Curve c = curves.get(0);
             // First point is always an order 0 curve (moveto)
             r.setRect(c.getX0(), c.getY0(), 0, 0);
             for (int i = 1; i < curves.size(); i++) {
-                ((Curve) curves.get(i)).enlarge(r);
+                curves.get(i).enlarge(r);
             }
         }
         return (cachedBounds = r);
@@ -507,7 +507,7 @@
         if (other == null) {
             return false;
         }
-        Vector c = new AreaOp.XorOp().calculate(this.curves, other.curves);
+        Vector<Curve> c = new AreaOp.XorOp().calculate(this.curves, other.curves);
         return c.isEmpty();
     }
 
@@ -555,10 +555,10 @@
         if (!getCachedBounds().contains(x, y)) {
             return false;
         }
-        Enumeration enum_ = curves.elements();
+        Enumeration<Curve> enum_ = curves.elements();
         int crossings = 0;
         while (enum_.hasMoreElements()) {
-            Curve c = (Curve) enum_.nextElement();
+            Curve c = enum_.nextElement();
             crossings += c.crossingsFor(x, y);
         }
         return ((crossings & 1) == 1);
@@ -658,16 +658,16 @@
 
 class AreaIterator implements PathIterator {
     private AffineTransform transform;
-    private Vector curves;
+    private Vector<Curve> curves;
     private int index;
     private Curve prevcurve;
     private Curve thiscurve;
 
-    public AreaIterator(Vector curves, AffineTransform at) {
+    public AreaIterator(Vector<Curve> curves, AffineTransform at) {
         this.curves = curves;
         this.transform = at;
         if (curves.size() >= 1) {
-            thiscurve = (Curve) curves.get(0);
+            thiscurve = curves.get(0);
         }
     }
 
@@ -689,7 +689,7 @@
             prevcurve = thiscurve;
             index++;
             if (index < curves.size()) {
-                thiscurve = (Curve) curves.get(index);
+                thiscurve = curves.get(index);
                 if (thiscurve.getOrder() != 0 &&
                     prevcurve.getX1() == thiscurve.getX0() &&
                     prevcurve.getY1() == thiscurve.getY0())
--- a/jdk/src/share/classes/java/awt/image/BufferedImage.java	Mon May 05 23:19:00 2014 -0700
+++ b/jdk/src/share/classes/java/awt/image/BufferedImage.java	Mon May 05 23:38:30 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,7 +76,7 @@
     ColorModel colorModel;
     WritableRaster raster;
     OffScreenImageSource osis;
-    Hashtable properties;
+    Hashtable<?, ?> properties;
 
     boolean    isAlphaPremultiplied;// If true, alpha has been premultiplied in
     // color channels
@@ -1106,7 +1106,7 @@
     public ImageProducer getSource() {
         if (osis == null) {
             if (properties == null) {
-                properties = new Hashtable();
+                properties = new Hashtable<>();
             }
             osis = new OffScreenImageSource(this, properties);
         }
--- a/jdk/src/share/classes/java/awt/image/CropImageFilter.java	Mon May 05 23:19:00 2014 -0700
+++ b/jdk/src/share/classes/java/awt/image/CropImageFilter.java	Mon May 05 23:38:30 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -79,6 +79,7 @@
      * with the filtering operation.
      */
     public void setProperties(Hashtable<?,?> props) {
+        @SuppressWarnings("unchecked")
         Hashtable<Object,Object> p = (Hashtable<Object,Object>)props.clone();
         p.put("croprect", new Rectangle(cropX, cropY, cropW, cropH));
         super.setProperties(p);
--- a/jdk/src/share/classes/java/awt/image/FilteredImageSource.java	Mon May 05 23:19:00 2014 -0700
+++ b/jdk/src/share/classes/java/awt/image/FilteredImageSource.java	Mon May 05 23:38:30 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,7 +68,7 @@
         filter = imgf;
     }
 
-    private Hashtable proxies;
+    private Hashtable<ImageConsumer, ImageFilter> proxies;
 
     /**
      * Adds the specified <code>ImageConsumer</code>
@@ -94,7 +94,7 @@
      */
     public synchronized void addConsumer(ImageConsumer ic) {
         if (proxies == null) {
-            proxies = new Hashtable();
+            proxies = new Hashtable<>();
         }
         if (!proxies.containsKey(ic)) {
             ImageFilter imgf = filter.getFilterInstance(ic);
@@ -137,7 +137,7 @@
      */
     public synchronized void removeConsumer(ImageConsumer ic) {
         if (proxies != null) {
-            ImageFilter imgf = (ImageFilter) proxies.get(ic);
+            ImageFilter imgf =  proxies.get(ic);
             if (imgf != null) {
                 src.removeConsumer(imgf);
                 proxies.remove(ic);
@@ -173,9 +173,9 @@
      */
     public void startProduction(ImageConsumer ic) {
         if (proxies == null) {
-            proxies = new Hashtable();
+            proxies = new Hashtable<>();
         }
-        ImageFilter imgf = (ImageFilter) proxies.get(ic);
+        ImageFilter imgf = proxies.get(ic);
         if (imgf == null) {
             imgf = filter.getFilterInstance(ic);
             proxies.put(ic, imgf);
@@ -200,7 +200,7 @@
      */
     public void requestTopDownLeftRightResend(ImageConsumer ic) {
         if (proxies != null) {
-            ImageFilter imgf = (ImageFilter) proxies.get(ic);
+            ImageFilter imgf = proxies.get(ic);
             if (imgf != null) {
                 imgf.resendTopDownLeftRight(src);
             }
--- a/jdk/src/share/classes/java/awt/image/ImageFilter.java	Mon May 05 23:19:00 2014 -0700
+++ b/jdk/src/share/classes/java/awt/image/ImageFilter.java	Mon May 05 23:38:30 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -104,6 +104,7 @@
      * @exception NullPointerException if <code>props</code> is null
      */
     public void setProperties(Hashtable<?,?> props) {
+        @SuppressWarnings("unchecked")
         Hashtable<Object,Object> p = (Hashtable<Object,Object>)props.clone();
         Object o = p.get("filters");
         if (o == null) {
--- a/jdk/src/share/classes/java/awt/image/MemoryImageSource.java	Mon May 05 23:19:00 2014 -0700
+++ b/jdk/src/share/classes/java/awt/image/MemoryImageSource.java	Mon May 05 23:38:30 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -111,8 +111,8 @@
     Object pixels;
     int pixeloffset;
     int pixelscan;
-    Hashtable properties;
-    Vector theConsumers = new Vector();
+    Hashtable<?, ?> properties;
+    Vector<ImageConsumer> theConsumers = new Vector<>();
     boolean animating;
     boolean fullbuffers;
 
@@ -197,7 +197,7 @@
     }
 
     private void initialize(int w, int h, ColorModel cm,
-                            Object pix, int off, int scan, Hashtable props) {
+                            Object pix, int off, int scan, Hashtable<?,?> props) {
         width = w;
         height = h;
         model = cm;
@@ -205,7 +205,7 @@
         pixeloffset = off;
         pixelscan = scan;
         if (props == null) {
-            props = new Hashtable();
+            props = new Hashtable<>();
         }
         properties = props;
     }
@@ -343,9 +343,9 @@
     public synchronized void setAnimated(boolean animated) {
         this.animating = animated;
         if (!animating) {
-            Enumeration enum_ = theConsumers.elements();
+            Enumeration<ImageConsumer> enum_ = theConsumers.elements();
             while (enum_.hasMoreElements()) {
-                ImageConsumer ic = (ImageConsumer) enum_.nextElement();
+                ImageConsumer ic = enum_.nextElement();
                 ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
                 if (isConsumer(ic)) {
                     ic.imageComplete(ImageConsumer.IMAGEERROR);
@@ -376,9 +376,9 @@
         }
         this.fullbuffers = fullbuffers;
         if (animating) {
-            Enumeration enum_ = theConsumers.elements();
+            Enumeration<ImageConsumer> enum_ = theConsumers.elements();
             while (enum_.hasMoreElements()) {
-                ImageConsumer ic = (ImageConsumer) enum_.nextElement();
+                ImageConsumer ic = enum_.nextElement();
                 ic.setHints(fullbuffers
                             ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                                ImageConsumer.COMPLETESCANLINES)
@@ -474,9 +474,9 @@
             if ((w <= 0 || h <= 0) && !framenotify) {
                 return;
             }
-            Enumeration enum_ = theConsumers.elements();
+            Enumeration<ImageConsumer> enum_ = theConsumers.elements();
             while (enum_.hasMoreElements()) {
-                ImageConsumer ic = (ImageConsumer) enum_.nextElement();
+                ImageConsumer ic = enum_.nextElement();
                 if (w > 0 && h > 0) {
                     sendPixels(ic, x, y, w, h);
                 }
--- a/jdk/src/share/classes/java/awt/image/ReplicateScaleFilter.java	Mon May 05 23:19:00 2014 -0700
+++ b/jdk/src/share/classes/java/awt/image/ReplicateScaleFilter.java	Mon May 05 23:38:30 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -121,6 +121,7 @@
      * with the filtering operation.
      */
     public void setProperties(Hashtable<?,?> props) {
+        @SuppressWarnings("unchecked")
         Hashtable<Object,Object> p = (Hashtable<Object,Object>)props.clone();
         String key = "rescale";
         String val = destWidth + "x" + destHeight;
--- a/jdk/src/share/classes/java/awt/image/renderable/ParameterBlock.java	Mon May 05 23:19:00 2014 -0700
+++ b/jdk/src/share/classes/java/awt/image/renderable/ParameterBlock.java	Mon May 05 23:38:30 2014 -0700
@@ -153,6 +153,7 @@
      *
      * @return an Object clone of the <code>ParameterBlock</code>.
      */
+    @SuppressWarnings("unchecked") // casts from clone
     public Object clone() {
         ParameterBlock theClone;
 
@@ -164,10 +165,10 @@
         }
 
         if (sources != null) {
-            theClone.setSources((Vector)sources.clone());
+            theClone.setSources((Vector<Object>)sources.clone());
         }
         if (parameters != null) {
-            theClone.setParameters((Vector)parameters.clone());
+            theClone.setParameters((Vector<Object>)parameters.clone());
         }
         return (Object) theClone;
     }
@@ -280,7 +281,7 @@
 
     /** Clears the list of source images. */
     public void removeSources() {
-        sources = new Vector();
+        sources = new Vector<>();
     }
 
     /**
@@ -313,7 +314,7 @@
 
     /** Clears the list of parameters. */
     public void removeParameters() {
-        parameters = new Vector();
+        parameters = new Vector<>();
     }
 
     /**
@@ -696,9 +697,9 @@
      * of the parameters.
      * @return an array of <code>Class</code> objects.
      */
-    public Class [] getParamClasses() {
+    public Class<?>[] getParamClasses() {
         int numParams = getNumParameters();
-        Class [] classes = new Class[numParams];
+        Class<?>[] classes = new Class<?>[numParams];
         int i;
 
         for (i = 0; i < numParams; i++) {
--- a/jdk/src/share/classes/java/awt/image/renderable/RenderableImageOp.java	Mon May 05 23:19:00 2014 -0700
+++ b/jdk/src/share/classes/java/awt/image/renderable/RenderableImageOp.java	Mon May 05 23:38:30 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -87,11 +87,11 @@
         return getRenderableSources();
     }
 
-    private Vector getRenderableSources() {
-        Vector sources = null;
+    private Vector<RenderableImage> getRenderableSources() {
+        Vector<RenderableImage> sources = null;
 
         if (paramBlock.getNumSources() > 0) {
-            sources = new Vector();
+            sources = new Vector<>();
             int i = 0;
             while (i < paramBlock.getNumSources()) {
                 Object o = paramBlock.getSource(i);
@@ -314,19 +314,19 @@
         // contains RenderableImage sources, they will be replaced by
         // RenderedImages.
         ParameterBlock renderedParamBlock = (ParameterBlock)paramBlock.clone();
-        Vector sources = getRenderableSources();
+        Vector<? extends Object> sources = getRenderableSources();
 
         try {
             // This assumes that if there is no renderable source, that there
             // is a rendered source in paramBlock
 
             if (sources != null) {
-                Vector renderedSources = new Vector();
+                Vector<Object> renderedSources = new Vector<>();
                 for (int i = 0; i < sources.size(); i++) {
                     rcOut = myCRIF.mapRenderContext(i, renderContext,
                                                     paramBlock, this);
                     RenderedImage rdrdImage =
-                       ((RenderableImage)sources.elementAt(i)).createRendering(rcOut);
+                        ((RenderableImage)sources.elementAt(i)).createRendering(rcOut);
                     if (rdrdImage == null) {
                         return null;
                     }
--- a/jdk/src/share/classes/java/awt/image/renderable/RenderableImageProducer.java	Mon May 05 23:19:00 2014 -0700
+++ b/jdk/src/share/classes/java/awt/image/renderable/RenderableImageProducer.java	Mon May 05 23:38:30 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,7 +68,7 @@
     RenderContext rc;
 
     /** A Vector of image consumers. */
-    Vector ics = new Vector();
+    Vector<ImageConsumer> ics = new Vector<>();
 
     /**
      * Constructs a new RenderableImageProducer from a RenderableImage
@@ -177,12 +177,12 @@
         int width = raster.getWidth();
         int height = raster.getHeight();
 
-        Enumeration icList;
+        Enumeration<ImageConsumer> icList;
         ImageConsumer ic;
         // Set up the ImageConsumers
         icList = ics.elements();
         while (icList.hasMoreElements()) {
-            ic = (ImageConsumer)icList.nextElement();
+            ic = icList.nextElement();
             ic.setDimensions(width,height);
             ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT |
                         ImageConsumer.COMPLETESCANLINES |
@@ -204,7 +204,7 @@
             // Now send the scanline to the Consumers
             icList = ics.elements();
             while (icList.hasMoreElements()) {
-                ic = (ImageConsumer)icList.nextElement();
+                ic = icList.nextElement();
                 ic.setPixels(0, j, width, 1, colorModel, pix, 0, width);
             }
         }
@@ -212,7 +212,7 @@
         // Now tell the consumers we're done.
         icList = ics.elements();
         while (icList.hasMoreElements()) {
-            ic = (ImageConsumer)icList.nextElement();
+            ic = icList.nextElement();
             ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
         }
     }
--- a/jdk/src/share/classes/java/awt/print/Book.java	Mon May 05 23:19:00 2014 -0700
+++ b/jdk/src/share/classes/java/awt/print/Book.java	Mon May 05 23:38:30 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,7 @@
     /**
      * The set of pages that make up the Book.
      */
-    private Vector mPages;
+    private Vector<BookPage> mPages;
 
  /* Instance Methods */
 
@@ -55,7 +55,7 @@
      *  Creates a new, empty <code>Book</code>.
      */
     public Book() {
-        mPages = new Vector();
+        mPages = new Vector<>();
     }
 
     /**
@@ -167,7 +167,7 @@
     private BookPage getPage(int pageIndex)
         throws ArrayIndexOutOfBoundsException
     {
-        return (BookPage) mPages.elementAt(pageIndex);
+        return mPages.elementAt(pageIndex);
     }
 
     /**
--- a/jdk/src/share/classes/java/awt/print/PrinterJob.java	Mon May 05 23:19:00 2014 -0700
+++ b/jdk/src/share/classes/java/awt/print/PrinterJob.java	Mon May 05 23:38:30 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -74,9 +74,9 @@
         if (security != null) {
             security.checkPrintJobAccess();
         }
-        return (PrinterJob) java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction() {
-            public Object run() {
+        return java.security.AccessController.doPrivileged(
+            new java.security.PrivilegedAction<PrinterJob>() {
+            public PrinterJob run() {
                 String nm = System.getProperty("java.awt.printerjob", null);
                 try {
                     return (PrinterJob)Class.forName(nm).newInstance();