diff options
Diffstat (limited to 'libjava/classpath/java/util/Stack.java')
-rw-r--r-- | libjava/classpath/java/util/Stack.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libjava/classpath/java/util/Stack.java b/libjava/classpath/java/util/Stack.java index 404a146c272..1d8792882ef 100644 --- a/libjava/classpath/java/util/Stack.java +++ b/libjava/classpath/java/util/Stack.java @@ -102,13 +102,14 @@ public class Stack<T> extends Vector<T> * @return the Object popped from the stack * @throws EmptyStackException if the stack is empty */ + @SuppressWarnings("unchecked") public synchronized T pop() { if (elementCount == 0) throw new EmptyStackException(); modCount++; - T obj = elementData[--elementCount]; + T obj = (T) elementData[--elementCount]; // Set topmost element to null to assist the gc in cleanup. elementData[elementCount] = null; @@ -121,12 +122,13 @@ public class Stack<T> extends Vector<T> * @return the top Object on the stack * @throws EmptyStackException if the stack is empty */ + @SuppressWarnings("unchecked") public synchronized T peek() { if (elementCount == 0) throw new EmptyStackException(); - return elementData[elementCount - 1]; + return (T) elementData[elementCount - 1]; } /** |