src/share/classes/sun/awt/util/IdentityArrayList.java
Print this page
rev 9830 : 8039642: Fix raw and unchecked warnings in sun.awt.*
Reviewed-by: darcy, prr
*** 283,292 ****
--- 283,293 ----
* @throws ArrayStoreException if the runtime type of the specified array
* is not a supertype of the runtime type of every element in
* this list
* @throws NullPointerException if the specified array is null
*/
+ @SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
if (a.length < size)
// Make a new array of a's runtime type, but my contents:
return (T[]) Arrays.copyOf(elementData, size, a.getClass());
System.arraycopy(elementData, 0, a, 0, size);
*** 305,315 ****
* @throws IndexOutOfBoundsException {@inheritDoc}
*/
public E get(int index) {
rangeCheck(index);
! return (E) elementData[index];
}
/**
* Replaces the element at the specified position in this list with
* the specified element.
--- 306,318 ----
* @throws IndexOutOfBoundsException {@inheritDoc}
*/
public E get(int index) {
rangeCheck(index);
! @SuppressWarnings("unchecked")
! E rv = (E) elementData[index];
! return rv;
}
/**
* Replaces the element at the specified position in this list with
* the specified element.
*** 320,329 ****
--- 323,333 ----
* @throws IndexOutOfBoundsException {@inheritDoc}
*/
public E set(int index, E element) {
rangeCheck(index);
+ @SuppressWarnings("unchecked")
E oldValue = (E) elementData[index];
elementData[index] = element;
return oldValue;
}
*** 369,378 ****
--- 373,383 ----
*/
public E remove(int index) {
rangeCheck(index);
modCount++;
+ @SuppressWarnings("unchecked")
E oldValue = (E) elementData[index];
int numMoved = size - index - 1;
if (numMoved > 0)
System.arraycopy(elementData, index+1, elementData, index,