src/share/classes/sun/awt/geom/Crossings.java

Print this page
rev 9717 : 8039642: Fix raw and unchecked warnings in sun.awt.*
Reviewed-by:

@@ -75,18 +75,18 @@
         return (limit == 0);
     }
 
     public abstract boolean covers(double ystart, double yend);
 
-    public static Crossings findCrossings(Vector curves,
+    public static Crossings findCrossings(Vector<? extends Curve> curves,
                                           double xlo, double ylo,
                                           double xhi, double yhi)
     {
         Crossings cross = new EvenOdd(xlo, ylo, xhi, yhi);
-        Enumeration enum_ = curves.elements();
+        Enumeration<? extends Curve> enum_ = curves.elements();
         while (enum_.hasMoreElements()) {
-            Curve c = (Curve) enum_.nextElement();
+            Curve c = enum_.nextElement();
             if (c.accumulateCrossings(cross)) {
                 return null;
             }
         }
         if (debug) {

@@ -235,11 +235,11 @@
         }
         record(ystart, yend, direction);
         return false;
     }
 
-    private Vector tmp = new Vector();
+    private Vector<Curve> tmp = new Vector<>();
 
     public boolean accumulateQuad(double x0, double y0, double coords[]) {
         if (y0 < ylo && coords[1] < ylo && coords[3] < ylo) {
             return false;
         }

@@ -256,13 +256,13 @@
                 record(Math.max(coords[3], ylo), Math.min(y0, yhi), -1);
             }
             return false;
         }
         Curve.insertQuad(tmp, x0, y0, coords);
-        Enumeration enum_ = tmp.elements();
+        Enumeration<Curve> enum_ = tmp.elements();
         while (enum_.hasMoreElements()) {
-            Curve c = (Curve) enum_.nextElement();
+            Curve c = enum_.nextElement();
             if (c.accumulateCrossings(this)) {
                 return true;
             }
         }
         tmp.clear();

@@ -294,13 +294,13 @@
                 record(Math.max(coords[5], ylo), Math.min(y0, yhi), -1);
             }
             return false;
         }
         Curve.insertCubic(tmp, x0, y0, coords);
-        Enumeration enum_ = tmp.elements();
+        Enumeration<Curve> enum_ = tmp.elements();
         while (enum_.hasMoreElements()) {
-            Curve c = (Curve) enum_.nextElement();
+            Curve c = enum_.nextElement();
             if (c.accumulateCrossings(this)) {
                 return true;
             }
         }
         tmp.clear();