jdk/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java
changeset 11279 d9dab5ec5044
parent 9242 ef138d47df58
child 18767 6214297bf27d
--- a/jdk/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java	Fri Dec 09 12:56:22 2011 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java	Mon Dec 12 10:45:54 2011 +0000
@@ -131,8 +131,9 @@
     /**
      * Returns item at index i.
      */
+    @SuppressWarnings("unchecked")
     final E itemAt(int i) {
-        return this.<E>cast(items[i]);
+        return (E) items[i];
     }
 
     /**
@@ -162,7 +163,8 @@
      */
     private E extract() {
         final Object[] items = this.items;
-        E x = this.<E>cast(items[takeIndex]);
+        @SuppressWarnings("unchecked")
+        E x = (E) items[takeIndex];
         items[takeIndex] = null;
         takeIndex = inc(takeIndex);
         --count;
@@ -647,7 +649,9 @@
             int n = 0;
             int max = count;
             while (n < max) {
-                c.add(this.<E>cast(items[i]));
+                @SuppressWarnings("unchecked")
+                E x = (E) items[i];
+                c.add(x);
                 items[i] = null;
                 i = inc(i);
                 ++n;
@@ -684,7 +688,9 @@
             int n = 0;
             int max = (maxElements < count) ? maxElements : count;
             while (n < max) {
-                c.add(this.<E>cast(items[i]));
+                @SuppressWarnings("unchecked")
+                E x = (E) items[i];
+                c.add(x);
                 items[i] = null;
                 i = inc(i);
                 ++n;