diff -r 92676a77a667 -r b95438b17098 jdk/src/share/classes/java/util/PriorityQueue.java --- a/jdk/src/share/classes/java/util/PriorityQueue.java Tue Apr 17 11:59:12 2012 -0700 +++ b/jdk/src/share/classes/java/util/PriorityQueue.java Tue Apr 17 12:21:56 2012 -0700 @@ -449,6 +449,7 @@ * this queue * @throws NullPointerException if the specified array is null */ + @SuppressWarnings("unchecked") public T[] toArray(T[] a) { if (a.length < size) // Make a new array of a's runtime type, but my contents: @@ -514,6 +515,7 @@ (forgetMeNot != null && !forgetMeNot.isEmpty()); } + @SuppressWarnings("unchecked") public E next() { if (expectedModCount != modCount) throw new ConcurrentModificationException(); @@ -571,8 +573,10 @@ return null; int s = --size; modCount++; - E result = (E) queue[0]; - E x = (E) queue[s]; + @SuppressWarnings("unchecked") + E result = (E) queue[0]; + @SuppressWarnings("unchecked") + E x = (E) queue[s]; queue[s] = null; if (s != 0) siftDown(0, x); @@ -598,7 +602,8 @@ if (s == i) // removed last element queue[i] = null; else { - E moved = (E) queue[s]; + @SuppressWarnings("unchecked") + E moved = (E) queue[s]; queue[s] = null; siftDown(i, moved); if (queue[i] == moved) { @@ -629,6 +634,7 @@ siftUpComparable(k, x); } + @SuppressWarnings("unchecked") private void siftUpComparable(int k, E x) { Comparable key = (Comparable) x; while (k > 0) { @@ -645,8 +651,9 @@ private void siftUpUsingComparator(int k, E x) { while (k > 0) { int parent = (k - 1) >>> 1; - Object e = queue[parent]; - if (comparator.compare(x, (E) e) >= 0) + @SuppressWarnings("unchecked") + E e = (E) queue[parent]; + if (comparator.compare(x, e) >= 0) break; queue[k] = e; k = parent; @@ -669,6 +676,7 @@ siftDownComparable(k, x); } + @SuppressWarnings("unchecked") private void siftDownComparable(int k, E x) { Comparable key = (Comparable)x; int half = size >>> 1; // loop while a non-leaf @@ -687,6 +695,7 @@ queue[k] = key; } + @SuppressWarnings("unchecked") private void siftDownUsingComparator(int k, E x) { int half = size >>> 1; while (k < half) { @@ -708,6 +717,7 @@ * Establishes the heap invariant (described above) in the entire tree, * assuming nothing about the order of the elements prior to the call. */ + @SuppressWarnings("unchecked") private void heapify() { for (int i = (size >>> 1) - 1; i >= 0; i--) siftDown(i, (E) queue[i]);