--- jsr166/src/main/java/util/PriorityQueue.java 2013/01/19 17:33:55 1.83 +++ jsr166/src/main/java/util/PriorityQueue.java 2013/01/19 18:18:10 1.85 @@ -451,7 +451,9 @@ public class PriorityQueue extends Ab * this queue * @throws NullPointerException if the specified array is null */ + @SuppressWarnings("unchecked") public T[] toArray(T[] a) { + final int size = this.size; if (a.length < size) // Make a new array of a's runtime type, but my contents: return (T[]) Arrays.copyOf(queue, size, a.getClass());