You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2006/06/26 12:11:42 UTC

svn commit: r417154 - /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/

Author: ndbeyer
Date: Mon Jun 26 03:11:40 2006
New Revision: 417154

URL: http://svn.apache.org/viewvc?rev=417154&view=rev
Log:
Add override, suppress warnings annotations and misc code cleanup.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashMap.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashSet.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/IdentityHashMap.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/LinkedHashMap.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/LinkedHashSet.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/LinkedList.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Observable.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/PriorityQueue.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashMap.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashMap.java?rev=417154&r1=417153&r2=417154&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashMap.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashMap.java Mon Jun 26 03:11:40 2006
@@ -50,6 +50,8 @@
             this.hash = (theKey == null) ? 0 : theKey.hashCode();
         }
 
+        @Override
+        @SuppressWarnings("unchecked")
         public Object clone() {
             Entry<K,V> entry = (Entry<K,V>) super.clone();
             if (next != null) {
@@ -58,10 +60,12 @@
             return entry;
         }
 
+        @Override
         public String toString() {
             return key + "=" + value;
         }
 
+        @Override
         public int hashCode() {
             return hash;
         }
@@ -162,14 +166,17 @@
             return associatedMap;
         }
 
+        @Override
         public int size() {
             return associatedMap.elementCount;
         }
 
+        @Override
         public void clear() {
             associatedMap.clear();
         }
 
+        @Override
         public boolean remove(Object object) {
             if (contains(object)) {
                 associatedMap.remove(((Map.Entry) object).getKey());
@@ -178,6 +185,7 @@
             return false;
         }
 
+        @Override
         public boolean contains(Object object) {
             if (object instanceof Map.Entry) {
                 Entry<KT, VT> entry = associatedMap.getEntry(((Map.Entry) object)
@@ -187,6 +195,7 @@
             return false;
         }
 
+        @Override
         public Iterator<Map.Entry<KT,VT>> iterator() {
             return new HashMapIterator<Map.Entry<KT,VT>,KT,VT>(new MapEntry.Type<Map.Entry<KT,VT>, KT, VT>() {
                 public Map.Entry<KT,VT> get(MapEntry<KT,VT> entry) {
@@ -202,6 +211,7 @@
      * @param s
      * @return Reference to the element array
      */
+    @SuppressWarnings("unchecked")
     Entry<K,V>[] newElementArray(int s) {
         return new Entry[s];
     }
@@ -277,6 +287,7 @@
      * @see #isEmpty
      * @see #size
      */
+    @Override
     public void clear() {
         if (elementCount > 0) {
             elementCount = 0;
@@ -292,6 +303,8 @@
      * 
      * @see java.lang.Cloneable
      */
+    @Override
+    @SuppressWarnings("unchecked")
     public Object clone() {
         try {
             HashMap<K,V> map = (HashMap<K,V>) super.clone();
@@ -320,6 +333,7 @@
      * @return true if <code>key</code> is a key of this HashMap, false
      *         otherwise
      */
+    @Override
     public boolean containsKey(Object key) {
         return getEntry(key) != null;
     }
@@ -346,6 +360,7 @@
      * @return true if <code>value</code> is a value of this HashMap, false
      *         otherwise
      */
+    @Override
     public boolean containsValue(Object value) {
         if (value != null) {
             for (int i = elementData.length; --i >= 0;) {
@@ -378,6 +393,7 @@
      * 
      * @return a Set of the mappings
      */
+    @Override
     public Set<Map.Entry<K, V>> entrySet() {
         return new HashMapEntrySet<K,V>(this);
     }
@@ -389,6 +405,7 @@
      *            the key
      * @return the value of the mapping with the specified key
      */
+    @Override
     public V get(Object key) {
         Entry<K, V> m = getEntry(key);
         if (m != null) {
@@ -431,6 +448,7 @@
      * 
      * @see #size
      */
+    @Override
     public boolean isEmpty() {
         return elementCount == 0;
     }
@@ -442,21 +460,26 @@
      * 
      * @return a Set of the keys
      */
+    @Override
     public Set<K> keySet() {
         if (keySet == null) {
             keySet = new AbstractSet<K>() {
+                @Override
                 public boolean contains(Object object) {
                     return containsKey(object);
                 }
 
+                @Override
                 public int size() {
                     return HashMap.this.size();
                 }
 
+                @Override
                 public void clear() {
                     HashMap.this.clear();
                 }
 
+                @Override
                 public boolean remove(Object key) {
                     if (containsKey(key)) {
                         HashMap.this.remove(key);
@@ -465,6 +488,7 @@
                     return false;
                 }
 
+                @Override
                 public Iterator<K> iterator() {
                     return new HashMapIterator<K,K,V>(new MapEntry.Type<K,K,V>() {
                         public K get(MapEntry<K,V> entry) {
@@ -487,6 +511,7 @@
      * @return the value of any previous mapping with the specified key or null
      *         if there was no mapping
      */
+    @Override
     public V put(K key, V value) {
         int index = getModuloHash(key);
         Entry<K,V> entry = findEntry(key, index);
@@ -518,6 +543,7 @@
      * @param map
      *            the Map to copy mappings from
      */
+    @Override
     public void putAll(Map<? extends K, ? extends V> map) {
         super.putAll(map);
     }
@@ -552,6 +578,7 @@
      * @return the value of the removed mapping or null if key is not a key in
      *         this HashMap
      */
+    @Override
     public V remove(Object key) {
         Entry<K, V> entry = removeEntry(key);
         if (entry != null) {
@@ -596,6 +623,7 @@
      * 
      * @return the number of mappings in this HashMap
      */
+    @Override
     public int size() {
         return elementCount;
     }
@@ -607,21 +635,26 @@
      * 
      * @return a Collection of the values
      */
+    @Override
     public Collection<V> values() {
         if (valuesCollection == null) {
             valuesCollection = new AbstractCollection<V>() {
+                @Override
                 public boolean contains(Object object) {
                     return containsValue(object);
                 }
 
+                @Override
                 public int size() {
                     return HashMap.this.size();
                 }
 
+                @Override
                 public void clear() {
                     HashMap.this.clear();
                 }
 
+                @Override
                 public Iterator<V> iterator() {
                     return new HashMapIterator<V,K,V>(new MapEntry.Type<V,K,V>() {
                         public V get(MapEntry<K,V> entry) {
@@ -647,11 +680,12 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream stream) throws IOException,
             ClassNotFoundException {
         stream.defaultReadObject();
         int length = stream.readInt();
-        elementData = new Entry[length];
+        elementData = newElementArray(length);
         elementCount = stream.readInt();
         for (int i = elementCount; --i >= 0;) {
             K key = (K)stream.readObject();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashSet.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashSet.java?rev=417154&r1=417153&r2=417154&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashSet.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashSet.java Mon Jun 26 03:11:40 2006
@@ -88,7 +88,8 @@
 	 * @return true when this HashSet did not already contain the object, false
 	 *         otherwise
 	 */
-	public boolean add(E object) {
+	@Override
+    public boolean add(E object) {
 		return backingMap.put(object, this) == null;
 	}
 
@@ -98,7 +99,8 @@
 	 * @see #isEmpty
 	 * @see #size
 	 */
-	public void clear() {
+	@Override
+    public void clear() {
 		backingMap.clear();
 	}
 
@@ -109,7 +111,9 @@
 	 * 
 	 * @see java.lang.Cloneable
 	 */
-	public Object clone() {
+	@Override
+    @SuppressWarnings("unchecked")
+    public Object clone() {
 		try {
 			HashSet<E> clone = (HashSet<E>) super.clone();
 			clone.backingMap = (HashMap<E, HashSet<E>>) backingMap.clone();
@@ -127,7 +131,8 @@
 	 * @return true if <code>object</code> is an element of this HashSet,
 	 *         false otherwise
 	 */
-	public boolean contains(Object object) {
+	@Override
+    public boolean contains(Object object) {
 		return backingMap.containsKey(object);
 	}
 
@@ -138,7 +143,8 @@
 	 * 
 	 * @see #size
 	 */
-	public boolean isEmpty() {
+	@Override
+    public boolean isEmpty() {
 		return backingMap.isEmpty();
 	}
 
@@ -149,7 +155,8 @@
 	 * 
 	 * @see Iterator
 	 */
-	public Iterator<E> iterator() {
+	@Override
+    public Iterator<E> iterator() {
 		return backingMap.keySet().iterator();
 	}
 
@@ -160,7 +167,8 @@
 	 *            the object to remove
 	 * @return true if this HashSet is modified, false otherwise
 	 */
-	public boolean remove(Object object) {
+	@Override
+    public boolean remove(Object object) {
 		return backingMap.remove(object) != null;
 	}
 
@@ -169,7 +177,8 @@
 	 * 
 	 * @return the number of elements in this HashSet
 	 */
-	public int size() {
+	@Override
+    public int size() {
 		return backingMap.size();
 	}
 
@@ -187,7 +196,8 @@
 		}
 	}
 
-	private void readObject(ObjectInputStream stream) throws IOException,
+	@SuppressWarnings("unchecked")
+    private void readObject(ObjectInputStream stream) throws IOException,
 			ClassNotFoundException {
 		stream.defaultReadObject();
 		int length = stream.readInt();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java?rev=417154&r1=417153&r2=417154&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java Mon Jun 26 03:11:40 2006
@@ -54,8 +54,15 @@
 
 	transient int modCount = 0;
 
-	private static final Enumeration emptyEnumerator = new Hashtable(0)
-			.getEmptyEnumerator();
+	private static final Enumeration<?> EMPTY_ENUMERATION = new Enumeration<Object>() {
+        public boolean hasMoreElements() {
+            return false;
+        }
+        
+        public Object nextElement() {
+            throw new NoSuchElementException();
+        }
+    };
 
 	private static <K, V> Entry<K, V> newEntry(K key, V value, int hash) {
 		return new Entry<K, V>(key, value);
@@ -71,7 +78,9 @@
 			hashcode = theKey.hashCode();
 		}
 
-		public Object clone() {
+		@Override
+        @SuppressWarnings("unchecked")
+        public Object clone() {
 			Entry<K, V> entry = (Entry<K, V>) super.clone();
 			if (next != null) {
                 entry.next = (Entry<K, V>) next.clone();
@@ -79,7 +88,8 @@
 			return entry;
 		}
 
-		public V setValue(V object) {
+		@Override
+        public V setValue(V object) {
 			if (object == null) {
                 throw new NullPointerException();
             }
@@ -96,7 +106,8 @@
 			return hashcode == aKey.hashCode() && key.equals(aKey);
 		}
 
-		public String toString() {
+		@Override
+        public String toString() {
 			return key + "=" + value;
 		}
 	}
@@ -224,7 +235,8 @@
 			return false;
 		}
 
-		public E nextElement() {
+		@SuppressWarnings("unchecked")
+        public E nextElement() {
 			if (hasMoreElements()) {
 				Object result = key ? entry.key : entry.value;
 				entry = entry.next;
@@ -252,7 +264,7 @@
 	public Hashtable(int capacity) {
 		if (capacity >= 0) {
 			elementCount = 0;
-			elementData = new Entry[capacity == 0 ? 1 : capacity];
+			elementData = newElementArray(capacity == 0 ? 1 : capacity);
 			firstSlot = elementData.length;
 			loadFactor = 0.75f;
 			computeMaxSize();
@@ -273,7 +285,7 @@
 		if (capacity >= 0 && loadFactor > 0) {
 			elementCount = 0;
 			firstSlot = capacity;
-			elementData = new Entry[capacity == 0 ? 1 : capacity];
+			elementData = newElementArray(capacity == 0 ? 1 : capacity);
 			this.loadFactor = loadFactor;
 			computeMaxSize();
 		} else {
@@ -293,9 +305,10 @@
 		putAll(map);
 	}
 
-	private HashEnumerator getEmptyEnumerator() {
-		return new HashEnumerator(false);
-	}
+    @SuppressWarnings("unchecked")
+    private Entry<K, V>[] newElementArray(int size) {
+        return new Entry[size];
+    }
 
 	/**
 	 * Removes all key/value pairs from this Hashtable, leaving the size zero
@@ -318,7 +331,9 @@
 	 * 
 	 * @see java.lang.Cloneable
 	 */
-	public synchronized Object clone() {
+	@Override
+    @SuppressWarnings("unchecked")
+    public synchronized Object clone() {
 		try {
 			Hashtable<K, V> hashtable = (Hashtable<K, V>) super.clone();
 			hashtable.elementData = elementData.clone();
@@ -404,9 +419,11 @@
 	 * @see #size
 	 * @see Enumeration
 	 */
-	public synchronized Enumeration<V> elements() {
+	@Override
+    @SuppressWarnings("unchecked")
+    public synchronized Enumeration<V> elements() {
 		if (elementCount == 0) {
-            return emptyEnumerator;
+            return (Enumeration<V>)EMPTY_ENUMERATION;
         }
 		return new HashEnumerator<V>(false);
 	}
@@ -420,15 +437,19 @@
 	 */
 	public Set<Map.Entry<K,V>> entrySet() {
 		return new Collections.SynchronizedSet<Map.Entry<K, V>>(new AbstractSet<Map.Entry<K,V>>() {
-			public int size() {
+			@Override
+            public int size() {
 				return elementCount;
 			}
 
-			public void clear() {
+			@Override
+            public void clear() {
 				Hashtable.this.clear();
 			}
 
-			public boolean remove(Object object) {
+			@Override
+            @SuppressWarnings("unchecked")
+            public boolean remove(Object object) {
 				if (contains(object)) {
 					Hashtable.this.remove(((Map.Entry<K, V>)object).getKey());
 					return true;
@@ -436,12 +457,15 @@
 				return false;
 			}
 
-			public boolean contains(Object object) {
+			@Override
+            @SuppressWarnings("unchecked")
+            public boolean contains(Object object) {
 				Entry<K, V> entry = getEntry(((Map.Entry<K, V>)object).getKey());
 				return object.equals(entry);
 			}
 
-			public Iterator<Map.Entry<K,V>> iterator() {
+			@Override
+            public Iterator<Map.Entry<K,V>> iterator() {
 				return new HashIterator<Map.Entry<K, V>>(new MapEntry.Type<Map.Entry<K, V>, K, V>() {
 					public Map.Entry<K, V> get(MapEntry<K, V> entry) {
 						return entry;
@@ -463,7 +487,8 @@
 	 * 
 	 * @see #hashCode
 	 */
-	public synchronized boolean equals(Object object) {
+	@Override
+    public synchronized boolean equals(Object object) {
 		if (this == object) {
             return true;
         }
@@ -494,7 +519,8 @@
 	 * 
 	 * @see #put
 	 */
-	public synchronized V get(Object key) {
+	@Override
+    public synchronized V get(Object key) {
 		int hash = key.hashCode();
 		int index = (hash & 0x7FFFFFFF) % elementData.length;
 		Entry<K,V> entry = elementData[index];
@@ -528,7 +554,8 @@
 	 * 
 	 * @see #equals
 	 */
-	public synchronized int hashCode() {
+	@Override
+    public synchronized int hashCode() {
 		int result = 0;
 		Iterator<Map.Entry<K, V>> it = entrySet().iterator();
 		while (it.hasNext()) {
@@ -550,7 +577,8 @@
 	 * 
 	 * @see #size
 	 */
-	public synchronized boolean isEmpty() {
+	@Override
+    public synchronized boolean isEmpty() {
 		return elementCount == 0;
 	}
 
@@ -565,9 +593,11 @@
 	 * @see #size
 	 * @see Enumeration
 	 */
-	public synchronized Enumeration<K> keys() {
+	@Override
+    @SuppressWarnings("unchecked")
+    public synchronized Enumeration<K> keys() {
 		if (elementCount == 0) {
-            return emptyEnumerator;
+            return (Enumeration<K>)EMPTY_ENUMERATION;
         }
 		return new HashEnumerator<K>(true);
 	}
@@ -582,19 +612,23 @@
 	public Set<K> keySet() {
 		return new Collections.SynchronizedSet<K>(
             new AbstractSet<K>() {
-    			public boolean contains(Object object) {
+    			@Override
+                public boolean contains(Object object) {
     				return containsKey(object);
     			}
     
-    			public int size() {
+    			@Override
+                public int size() {
     				return elementCount;
     			}
     
-    			public void clear() {
+    			@Override
+                public void clear() {
     				Hashtable.this.clear();
     			}
     
-    			public boolean remove(Object key) {
+    			@Override
+                public boolean remove(Object key) {
     				if (containsKey(key)) {
     					Hashtable.this.remove(key);
     					return true;
@@ -602,7 +636,8 @@
     				return false;
     			}
     
-    			public Iterator<K> iterator() {
+    			@Override
+                public Iterator<K> iterator() {
     				return new HashIterator<K>(
                         new MapEntry.Type<K, K, V>() {
         					public K get(MapEntry<K, V> entry) {
@@ -630,7 +665,8 @@
 	 * @see #keys
 	 * @see java.lang.Object#equals
 	 */
-	public synchronized V put(K key, V value) {
+	@Override
+    public synchronized V put(K key, V value) {
 		if (key != null && value != null) {
 			int hash = key.hashCode();
 			int index = (hash & 0x7FFFFFFF) % elementData.length;
@@ -679,14 +715,14 @@
 	 * Increases the capacity of this Hashtable. This method is sent when the
 	 * size of this Hashtable exceeds the load factor.
 	 */
-	protected void rehash() {
+    protected void rehash() {
 		int length = (elementData.length << 1) + 1;
 		if (length == 0) {
             length = 1;
         }
 		int newFirst = length;
 		int newLast = -1;
-		Entry<K, V>[] newData = new Entry[length];
+		Entry<K, V>[] newData = newElementArray(length);
 		for (int i = lastSlot + 1; --i >= firstSlot;) {
 			Entry<K, V> entry = elementData[i];
 			while (entry != null) {
@@ -720,7 +756,8 @@
 	 * @see #get
 	 * @see #put
 	 */
-	public synchronized V remove(Object key) {
+	@Override
+    public synchronized V remove(Object key) {
 		int hash = key.hashCode();
 		int index = (hash & 0x7FFFFFFF) % elementData.length;
 		Entry<K, V> last = null;
@@ -752,7 +789,8 @@
 	 * @see #elements
 	 * @see #keys
 	 */
-	public synchronized int size() {
+	@Override
+    public synchronized int size() {
 		return elementCount;
 	}
 
@@ -761,7 +799,8 @@
 	 * 
 	 * @return the string representation of this Hashtable
 	 */
-	public synchronized String toString() {
+	@Override
+    public synchronized String toString() {
 		if (isEmpty()) {
             return "{}";
         }
@@ -803,19 +842,23 @@
 	 */
 	public Collection<V> values() {
 		return new Collections.SynchronizedCollection<V>(new AbstractCollection<V>() {
-			public boolean contains(Object object) {
+			@Override
+            public boolean contains(Object object) {
 				return Hashtable.this.contains(object);
 			}
 
-			public int size() {
+			@Override
+            public int size() {
 				return elementCount;
 			}
 
-			public void clear() {
+			@Override
+            public void clear() {
 				Hashtable.this.clear();
 			}
 
-			public Iterator<V> iterator() {
+			@Override
+            public Iterator<V> iterator() {
 				return new HashIterator<V>(new MapEntry.Type<V, K, V>() {
 					public V get(MapEntry<K, V> entry) {
 						return entry.value;
@@ -840,11 +883,12 @@
 		}
 	}
 
-	private void readObject(ObjectInputStream stream) throws IOException,
+	@SuppressWarnings("unchecked")
+    private void readObject(ObjectInputStream stream) throws IOException,
 			ClassNotFoundException {
 		stream.defaultReadObject();
 		int length = stream.readInt();
-		elementData = new Entry[length];
+		elementData = newElementArray(length);
 		elementCount = stream.readInt();
 		for (int i = elementCount; --i >= 0;) {
 			Object key = stream.readObject();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/IdentityHashMap.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/IdentityHashMap.java?rev=417154&r1=417153&r2=417154&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/IdentityHashMap.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/IdentityHashMap.java Mon Jun 26 03:11:40 2006
@@ -83,11 +83,13 @@
 			super(theKey, theValue);
 		}
 
-		public Object clone() {
+		@Override
+        public Object clone() {
 			return super.clone();
 		}
 
-		public boolean equals(Object object) {
+		@Override
+        public boolean equals(Object object) {
 			if (this == object) {
                 return true;
             }
@@ -98,12 +100,14 @@
 			return false;
 		}
 
-		public int hashCode() {
+		@Override
+        public int hashCode() {
 			return System.identityHashCode(key)
 					^ System.identityHashCode(value);
 		}
 
-		public String toString() {
+		@Override
+        public String toString() {
 			return key + "=" + value;
 		}
 	}
@@ -184,15 +188,18 @@
 			return associatedMap;
 		}
 
-		public int size() {
+		@Override
+        public int size() {
 			return associatedMap.size;
 		}
 
-		public void clear() {
+		@Override
+        public void clear() {
 			associatedMap.clear();
 		}
 
-		public boolean remove(Object object) {
+		@Override
+        public boolean remove(Object object) {
 			if (contains(object)) {
 				associatedMap.remove(((Map.Entry) object).getKey());
 				return true;
@@ -200,7 +207,8 @@
 			return false;
 		}
 
-		public boolean contains(Object object) {
+		@Override
+        public boolean contains(Object object) {
 			if (object instanceof Map.Entry) {
 				IdentityHashMapEntry<?, ?> entry = associatedMap
 						.getEntry(((Map.Entry) object).getKey());
@@ -210,7 +218,8 @@
 			return false;
 		}
 
-		public Iterator<Map.Entry<KT, VT>> iterator() {
+		@Override
+        public Iterator<Map.Entry<KT, VT>> iterator() {
 			return new IdentityHashMapIterator<Map.Entry<KT,VT>,KT,VT>(new MapEntry.Type<Map.Entry<KT,VT>, KT, VT>() {
 				public Map.Entry<KT,VT> get(MapEntry<KT,VT> entry) {
 					return entry;
@@ -274,6 +283,11 @@
 		this(map.size() < 6 ? 11 : map.size() * 2);
 		putAll(map);
 	}
+    
+    @SuppressWarnings("unchecked")
+    private V massageValue(Object value) {
+        return (V)((value == NULL_OBJECT) ? null : value);
+    }
 
 	/**
 	 * Removes all elements from this Map, leaving it empty.
@@ -284,7 +298,8 @@
 	 * @see #isEmpty
 	 * @see #size
 	 */
-	public void clear() {
+	@Override
+    public void clear() {
 		size = 0;
 		for (int i = 0; i < elementData.length; i++) {
 			elementData[i] = null;
@@ -299,7 +314,8 @@
 	 *            the object to search for
 	 * @return true if <code>key</code> is a key of this Map, false otherwise
 	 */
-	public boolean containsKey(Object key) {
+	@Override
+    public boolean containsKey(Object key) {
 		if (key == null) {
 			key = NULL_OBJECT;
 		}
@@ -317,7 +333,8 @@
 	 * @return true if <code>value</code> is a value of this Map, false
 	 *         otherwise
 	 */
-	public boolean containsValue(Object value) {
+	@Override
+    public boolean containsValue(Object value) {
 		if (value == null) {
 			value = NULL_OBJECT;
 		}
@@ -337,7 +354,8 @@
 	 *            the key
 	 * @return the value of the mapping with the specified key
 	 */
-	public V get(Object key) {
+    @Override
+    public V get(Object key) {
 		if (key == null) {
 			key = NULL_OBJECT;
 		}
@@ -346,7 +364,7 @@
 
 		if (elementData[index] == key) {
 			Object result = elementData[index + 1];
-			return (V)((result == NULL_OBJECT) ? null : result);
+			return massageValue(result);
 		}
 
 		return null;
@@ -369,7 +387,8 @@
 	 * Convenience method for getting the IdentityHashMapEntry without the
 	 * NULL_OBJECT elements
 	 */
-	private IdentityHashMapEntry<K, V> getEntry(int index) {
+	@SuppressWarnings("unchecked")
+    private IdentityHashMapEntry<K, V> getEntry(int index) {
 		Object key = elementData[index];
 		Object value = elementData[index + 1];
 
@@ -418,7 +437,8 @@
 	 * @return the value of any previous mapping with the specified key or null
 	 *         if there was no mapping
 	 */
-	public V put(K key, V value) {
+    @Override
+    public V put(K key, V value) {
         Object _key = key;
         Object _value = value;
 		if (_key == null) {
@@ -448,7 +468,7 @@
 		Object result = elementData[index + 1];
 		elementData[index + 1] = _value;
 
-		return (V)((result == NULL_OBJECT) ? null : result);
+		return massageValue(result);
 	}
 
 	private void rehash() {
@@ -482,7 +502,8 @@
 	 * @return the value of the removed mapping, or null if key is not a key in
 	 *         this Map
 	 */
-	public V remove(Object key) {
+	@Override
+    public V remove(Object key) {
 		if (key == null) {
 			key = NULL_OBJECT;
 		}
@@ -530,7 +551,7 @@
 		elementData[index] = null;
 		elementData[index + 1] = null;
 
-		return (V)((result == NULL_OBJECT) ? null : result);
+		return massageValue(result);
 	}
 
 	/**
@@ -541,7 +562,8 @@
 	 * 
 	 * @return a Set of the mappings
 	 */
-	public Set<Map.Entry<K, V>> entrySet() {
+	@Override
+    public Set<Map.Entry<K, V>> entrySet() {
 		return new IdentityHashMapEntrySet<K, V>(this);
 	}
 
@@ -552,22 +574,27 @@
 	 * 
 	 * @return a Set of the keys
 	 */
-	public Set<K> keySet() {
+	@Override
+    public Set<K> keySet() {
 		if (keySet == null) {
 			keySet = new AbstractSet<K>() {
-				public boolean contains(Object object) {
+				@Override
+                public boolean contains(Object object) {
 					return containsKey(object);
 				}
 
-				public int size() {
+				@Override
+                public int size() {
 					return IdentityHashMap.this.size();
 				}
 
-				public void clear() {
+				@Override
+                public void clear() {
 					IdentityHashMap.this.clear();
 				}
 
-				public boolean remove(Object key) {
+				@Override
+                public boolean remove(Object key) {
 					if (containsKey(key)) {
 						IdentityHashMap.this.remove(key);
 						return true;
@@ -575,7 +602,8 @@
 					return false;
 				}
 
-				public Iterator<K> iterator() {
+				@Override
+                public Iterator<K> iterator() {
 					return new IdentityHashMapIterator<K,K,V>(new MapEntry.Type<K,K,V>() {
                         public K get(MapEntry<K,V> entry) {
                             return entry.key;
@@ -594,22 +622,27 @@
 	 * 
 	 * @return a Collection of the values
 	 */
-	public Collection<V> values() {
+	@Override
+    public Collection<V> values() {
 		if (valuesCollection == null) {
 			valuesCollection = new AbstractCollection<V>() {
-				public boolean contains(Object object) {
+				@Override
+                public boolean contains(Object object) {
 					return containsValue(object);
 				}
 
-				public int size() {
+				@Override
+                public int size() {
 					return IdentityHashMap.this.size();
 				}
 
-				public void clear() {
+				@Override
+                public void clear() {
 					IdentityHashMap.this.clear();
 				}
 
-				public Iterator<V> iterator() {
+				@Override
+                public Iterator<V> iterator() {
 					return new IdentityHashMapIterator<V,K,V>(new MapEntry.Type<V,K,V>() {
                         public V get(MapEntry<K,V> entry) {
                             return entry.value;
@@ -617,7 +650,8 @@
 					}, IdentityHashMap.this);
 				}
 				
-				public boolean remove(Object object) {
+				@Override
+                public boolean remove(Object object) {
 					Iterator<?> it = iterator();
 					while (it.hasNext()) {
 						if (object == it.next()) {
@@ -643,7 +677,8 @@
 	 * 
 	 * @return whether the argument object is equal to this object
 	 */
-	public boolean equals(Object object) {
+	@Override
+    public boolean equals(Object object) {
 		// we need to override the equals method in AbstractMap because
 		// AbstractMap.equals will call ((Map) object).entrySet().contains() to
 		// determine equality of the entries, so it will defer to the argument
@@ -675,7 +710,8 @@
 	 * 
 	 * @see java.lang.Cloneable
 	 */
-	public Object clone() {
+	@Override
+    public Object clone() {
 		try {
 			return super.clone();
 		} catch (CloneNotSupportedException e) {
@@ -690,7 +726,8 @@
 	 * 
 	 * @see #size
 	 */
-	public boolean isEmpty() {
+	@Override
+    public boolean isEmpty() {
 		return size == 0;
 	}
 
@@ -699,7 +736,8 @@
 	 * 
 	 * @return the number of mappings in this IdentityHashMap
 	 */
-	public int size() {
+	@Override
+    public int size() {
 		return size;
 	}
 
@@ -713,7 +751,8 @@
 		}
 	}
 
-	private void readObject(ObjectInputStream stream) throws IOException,
+	@SuppressWarnings("unchecked")
+    private void readObject(ObjectInputStream stream) throws IOException,
 			ClassNotFoundException {
 		int savedSize = stream.readInt();
 		threshold = getThreshold(DEFAULT_MAX_SIZE);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/LinkedHashMap.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/LinkedHashMap.java?rev=417154&r1=417153&r2=417154&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/LinkedHashMap.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/LinkedHashMap.java Mon Jun 26 03:11:40 2006
@@ -109,14 +109,17 @@
             entry = hm.head;
         }
 
+        @Override
         public boolean hasNext() {
             return (entry != null);
         }
 
+        @Override
         public E next() {
             checkConcurrentMod();
-            if (!hasNext())
+            if (!hasNext()) {
                 throw new NoSuchElementException();
+            }
             E result = type.get(entry);
             lastEntry = entry;
             entry = ((LinkedHashMapEntry<KT, VT>)entry).chainForward;
@@ -124,10 +127,12 @@
             return result;
         }
 
+        @Override
         public void remove() {
             checkConcurrentMod();
-            if (!canRemove)
+            if (!canRemove) {
                 throw new IllegalStateException();
+            }
 
             canRemove = false;
             associatedMap.modCount++;
@@ -138,8 +143,9 @@
                 associatedMap.elementData[index] = lastEntry.next;
             } else {
                 while (m.next != null) {
-                    if (m.next == lastEntry)
+                    if (m.next == lastEntry) {
                         break;
+                    }
                     m = (LinkedHashMapEntry<KT, VT>) m.next;
                 }
                 // assert m.next == entry
@@ -151,16 +157,18 @@
             LinkedHashMap<KT, VT> lhm = (LinkedHashMap<KT, VT>) associatedMap;
             if (p != null) {
                 p.chainForward = n;
-                if (n != null)
+                if (n != null) {
                     n.chainBackward = p;
-                else
+                } else {
                     lhm.tail = p;
+                }
             } else {
                 lhm.head = n;
-                if (n != null)
+                if (n != null) {
                     n.chainBackward = null;
-                else
+                } else {
                     lhm.tail = null;
+                }
             }
             associatedMap.elementCount--;
             expectedModCount++;
@@ -172,6 +180,7 @@
             super(lhm);
         }
 
+        @Override
         public Iterator<Map.Entry<KT,VT>> iterator() {
             return new LinkedHashIterator<Map.Entry<KT,VT>,KT,VT>(new MapEntry.Type<Map.Entry<KT,VT>, KT, VT>() {
                 public Map.Entry<KT,VT> get(MapEntry<KT,VT> entry) {
@@ -190,13 +199,16 @@
             chainBackward = null;
         }
 
+        @Override
+        @SuppressWarnings("unchecked")
         public Object clone() {
             LinkedHashMapEntry<K, V> entry = (LinkedHashMapEntry<K, V>) super.clone();
             entry.chainBackward = chainBackward;
             entry.chainForward = chainForward;
             LinkedHashMapEntry<K, V> lnext = (LinkedHashMapEntry<K, V>) entry.next;
-            if (lnext != null)
+            if (lnext != null) {
                 entry.next = (LinkedHashMapEntry<K, V>) lnext.clone();
+            }
             return entry;
         }
     }
@@ -207,6 +219,8 @@
      * @param s
      * @return Reference to the element array
      */
+    @Override
+    @SuppressWarnings("unchecked")
     Entry<K, V>[] newElementArray(int s) {
         return new LinkedHashMapEntry[s];
     }
@@ -218,18 +232,21 @@
      *            Key value
      * @return mapped value or null if the key is not in the map
      */
+    @Override
     public V get(Object key) {
         LinkedHashMapEntry<K, V> m = (LinkedHashMapEntry<K, V>) getEntry(key);
-        if (m == null)
+        if (m == null) {
             return null;
+        }
         if (accessOrder && tail != m) {
             LinkedHashMapEntry<K, V> p = m.chainBackward;
             LinkedHashMapEntry<K, V> n = m.chainForward;
             n.chainBackward = p;
-            if (p != null)
+            if (p != null) {
                 p.chainForward = n;
-            else
+            } else {
                 head = n;
+            }
             m.chainForward = null;
             m.chainBackward = tail;
             tail.chainForward = m;
@@ -241,6 +258,7 @@
     /*
      * @param key @param index @return Entry
      */
+    @Override
     Entry<K, V> createEntry(K key, int index, V value) {
         LinkedHashMapEntry<K, V> m = new LinkedHashMapEntry<K, V>(key, value);
         m.next = elementData[index];
@@ -259,6 +277,7 @@
      * @return The old value if the key was already in the map or null
      *         otherwise.
      */
+    @Override
     public V put(K key, V value) {
         int index = getModuloHash(key);
         LinkedHashMapEntry<K, V> m = (LinkedHashMapEntry<K, V>) findEntry(key, index);
@@ -282,8 +301,9 @@
         V result = m.value;
         m.value = value;
 
-        if (removeEldestEntry(head))
+        if (removeEldestEntry(head)) {
             remove(head.key);
+        }
 
         return result;
     }
@@ -350,6 +370,7 @@
      * @param m
      *            Input map
      */
+    @Override
     public void putAll(Map<? extends K, ? extends V> m) {
         for (Map.Entry<? extends K, ? extends V> e : m.entrySet()) {
             put(e.getKey(), e.getValue());
@@ -363,6 +384,7 @@
      * 
      * @return a Set of the mappings
      */
+    @Override
     public Set<Map.Entry<K, V>> entrySet() {
         return new LinkedHashMapEntrySet<K, V>(this);
     }
@@ -374,21 +396,26 @@
      * 
      * @return a Set of the keys
      */
+    @Override
     public Set<K> keySet() {
         if (keySet == null) {
             keySet = new AbstractSet<K>() {
+                @Override
                 public boolean contains(Object object) {
                     return containsKey(object);
                 }
 
+                @Override
                 public int size() {
                     return LinkedHashMap.this.size();
                 }
 
+                @Override
                 public void clear() {
                     LinkedHashMap.this.clear();
                 }
 
+                @Override
                 public boolean remove(Object key) {
                     if (containsKey(key)) {
                         LinkedHashMap.this.remove(key);
@@ -397,6 +424,7 @@
                     return false;
                 }
 
+                @Override
                 public Iterator<K> iterator() {
                     return new LinkedHashIterator<K,K,V>(new MapEntry.Type<K,K,V>() {
                         public K get(MapEntry<K,V> entry) {
@@ -416,21 +444,26 @@
      * 
      * @return a Collection of the values
      */
+    @Override
     public Collection<V> values() {
         if (valuesCollection == null) {
             valuesCollection = new AbstractCollection<V>() {
+                @Override
                 public boolean contains(Object object) {
                     return containsValue(object);
                 }
 
+                @Override
                 public int size() {
                     return LinkedHashMap.this.size();
                 }
 
+                @Override
                 public void clear() {
                     LinkedHashMap.this.clear();
                 }
 
+                @Override
                 public Iterator<V> iterator() {
                     return new LinkedHashIterator<V,K,V>(new MapEntry.Type<V,K,V>() {
                         public V get(MapEntry<K,V> entry) {
@@ -451,20 +484,24 @@
      * @return the value associated with the key or null if the key was no in
      *         the map
      */
+    @Override
     public V remove(Object key) {
         LinkedHashMapEntry<K, V> m = (LinkedHashMapEntry<K, V>) removeEntry(key);
-        if (m == null)
+        if (m == null) {
             return null;
+        }
         LinkedHashMapEntry<K, V> p = m.chainBackward;
         LinkedHashMapEntry<K, V> n = m.chainForward;
-        if (p != null)
+        if (p != null) {
             p.chainForward = n;
-        else
+        } else {
             head = n;
-        if (n != null)
+        }
+        if (n != null) {
             n.chainBackward = p;
-        else
+        } else {
             tail = p;
+        }
         return m.value;
     }
 
@@ -487,6 +524,7 @@
      * @see #isEmpty()
      * @see #size()
      */
+    @Override
     public void clear() {
         super.clear();
         head = tail = null;
@@ -499,6 +537,8 @@
      * 
      * @see java.lang.Cloneable
      */
+    @Override
+    @SuppressWarnings("unchecked")
     public Object clone() {
         LinkedHashMap<K, V> map = (LinkedHashMap<K, V>) super.clone();
         map.clear();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/LinkedHashSet.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/LinkedHashSet.java?rev=417154&r1=417153&r2=417154&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/LinkedHashSet.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/LinkedHashSet.java Mon Jun 26 03:11:40 2006
@@ -79,7 +79,8 @@
 	}
 
 	/* overrides method in HashMap */
-	HashMap<E, HashSet<E>> createBackingMap(int capacity, float loadFactor) {
+	@Override
+    HashMap<E, HashSet<E>> createBackingMap(int capacity, float loadFactor) {
 		return new LinkedHashMap<E, HashSet<E>>(capacity, loadFactor);
 	}
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/LinkedList.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/LinkedList.java?rev=417154&r1=417153&r2=417154&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/LinkedList.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/LinkedList.java Mon Jun 26 03:11:40 2006
@@ -65,14 +65,17 @@
 				// if link == voidLink then pos must == -1
 				link = list.voidLink;
 				if (location < list.size / 2) {
-					for (pos = -1; pos + 1 < location; pos++)
-						link = link.next;
+					for (pos = -1; pos + 1 < location; pos++) {
+                        link = link.next;
+                    }
 				} else {
-					for (pos = list.size; pos >= location; pos--)
-						link = link.previous;
+					for (pos = list.size; pos >= location; pos--) {
+                        link = link.previous;
+                    }
 				}
-			} else
-				throw new IndexOutOfBoundsException();
+			} else {
+                throw new IndexOutOfBoundsException();
+            }
 		}
 
 		public void add(ET object) {
@@ -87,8 +90,9 @@
 				expectedModCount++;
 				list.size++;
 				list.modCount++;
-			} else
-				throw new ConcurrentModificationException();
+			} else {
+                throw new ConcurrentModificationException();
+            }
 		}
 
 		public boolean hasNext() {
@@ -106,10 +110,12 @@
 					lastLink = link = next;
 					pos++;
 					return link.data;
-				} else
-					throw new NoSuchElementException();
-			} else
-				throw new ConcurrentModificationException();
+				} else {
+                    throw new NoSuchElementException();
+                }
+			} else {
+                throw new ConcurrentModificationException();
+            }
 		}
 
 		public int nextIndex() {
@@ -123,10 +129,12 @@
 					link = link.previous;
 					pos--;
 					return lastLink.data;
-				} else
-					throw new NoSuchElementException();
-			} else
-				throw new ConcurrentModificationException();
+				} else {
+                    throw new NoSuchElementException();
+                }
+			} else {
+                throw new ConcurrentModificationException();
+            }
 		}
 
 		public int previousIndex() {
@@ -140,27 +148,32 @@
 					Link<ET> previous = lastLink.previous;
 					next.previous = previous;
 					previous.next = next;
-					if (lastLink == link)
-						pos--;
+					if (lastLink == link) {
+                        pos--;
+                    }
 					link = previous;
 					lastLink = null;
 					expectedModCount++;
 					list.size--;
 					list.modCount++;
-				} else
-					throw new IllegalStateException();
-			} else
-				throw new ConcurrentModificationException();
+				} else {
+                    throw new IllegalStateException();
+                }
+			} else {
+                throw new ConcurrentModificationException();
+            }
 		}
 
 		public void set(ET object) {
 			if (expectedModCount == list.modCount) {
-				if (lastLink != null)
-					lastLink.data = object;
-				else
-					throw new IllegalStateException();
-			} else
-				throw new ConcurrentModificationException();
+				if (lastLink != null) {
+                    lastLink.data = object;
+                } else {
+                    throw new IllegalStateException();
+                }
+			} else {
+                throw new ConcurrentModificationException();
+            }
 		}
 	}
 
@@ -202,15 +215,18 @@
 	 * @exception IndexOutOfBoundsException
 	 *                when <code>location < 0 || >= size()</code>
 	 */
-	public void add(int location, E object) {
+	@Override
+    public void add(int location, E object) {
 		if (0 <= location && location <= size) {
 			Link<E> link = voidLink;
 			if (location < (size / 2)) {
-				for (int i = 0; i <= location; i++)
-					link = link.next;
+				for (int i = 0; i <= location; i++) {
+                    link = link.next;
+                }
 			} else {
-				for (int i = size; i > location; i--)
-					link = link.previous;
+				for (int i = size; i > location; i--) {
+                    link = link.previous;
+                }
 			}
 			Link<E> previous = link.previous;
 			Link<E> newLink = new Link<E>(object, previous, link);
@@ -218,8 +234,9 @@
 			link.previous = newLink;
 			size++;
 			modCount++;
-		} else
-			throw new IndexOutOfBoundsException();
+		} else {
+            throw new IndexOutOfBoundsException();
+        }
 	}
 
 	/**
@@ -229,7 +246,8 @@
 	 *            the object to add
 	 * @return true
 	 */
-	public boolean add(E object) {
+	@Override
+    public boolean add(E object) {
 		// Cannot call addLast() as subclasses can override
 		Link<E> oldLast = voidLink.previous;
 		Link<E> newLink = new Link<E>(object, oldLast, voidLink);
@@ -252,6 +270,7 @@
      * @exception IndexOutOfBoundsException when
      *            <code>location < 0 || > size()</code>
      */
+    @Override
     public boolean addAll(int location, Collection<? extends E> collection) {
         if (location < 0 || location > size) {
             throw new IndexOutOfBoundsException();
@@ -291,10 +310,12 @@
 	 *            the Collection of objects
 	 * @return true if this LinkedList is modified, false otherwise
 	 */
-	public boolean addAll(Collection<? extends E> collection) {
+	@Override
+    public boolean addAll(Collection<? extends E> collection) {
 		int adding = collection.size();
-		if (adding == 0)
-			return false;
+		if (adding == 0) {
+            return false;
+        }
 		Link<E> previous = voidLink.previous;
         for (E e : collection) {
 			Link<E> newLink = new Link<E>(e, previous, null);
@@ -344,7 +365,8 @@
 	 * @see List#isEmpty
 	 * @see #size
 	 */
-	public void clear() {
+	@Override
+    public void clear() {
 		if (size > 0) {
 			size = 0;
 			voidLink.next = voidLink;
@@ -361,7 +383,8 @@
 	 * 
 	 * @see java.lang.Cloneable
 	 */
-	public Object clone() {
+	@Override
+    public Object clone() {
 		return new LinkedList<E>(this);
 	}
 
@@ -373,37 +396,44 @@
 	 * @return true if <code>object</code> is an element of this LinkedList,
 	 *         false otherwise
 	 */
-	public boolean contains(Object object) {
+	@Override
+    public boolean contains(Object object) {
 		Link<E> link = voidLink.next;
 		if (object != null) {
 			while (link != voidLink) {
-				if (object.equals(link.data))
-					return true;
+				if (object.equals(link.data)) {
+                    return true;
+                }
 				link = link.next;
 			}
 		} else {
 			while (link != voidLink) {
-				if (link.data == null)
-					return true;
+				if (link.data == null) {
+                    return true;
+                }
 				link = link.next;
 			}
 		}
 		return false;
 	}
 
-	public E get(int location) {
+	@Override
+    public E get(int location) {
 		if (0 <= location && location < size) {
 			Link<E> link = voidLink;
 			if (location < (size / 2)) {
-				for (int i = 0; i <= location; i++)
-					link = link.next;
+				for (int i = 0; i <= location; i++) {
+                    link = link.next;
+                }
 			} else {
-				for (int i = size; i > location; i--)
-					link = link.previous;
+				for (int i = size; i > location; i--) {
+                    link = link.previous;
+                }
 			}
 			return link.data;
-		} else
-			throw new IndexOutOfBoundsException();
+		} else {
+            throw new IndexOutOfBoundsException();
+        }
 	}
 
 	/**
@@ -416,8 +446,9 @@
 	 */
 	public E getFirst() {
 		Link<E> first = voidLink.next;
-		if (first != voidLink)
-			return first.data;
+		if (first != voidLink) {
+            return first.data;
+        }
 		throw new NoSuchElementException();
 	}
 
@@ -431,8 +462,9 @@
 	 */
 	public E getLast() {
 		Link<E> last = voidLink.previous;
-		if (last != voidLink)
-			return last.data;
+		if (last != voidLink) {
+            return last.data;
+        }
 		throw new NoSuchElementException();
 	}
 
@@ -444,20 +476,23 @@
 	 *            the object to search for
 	 * @return the index of the first occurrence of the object
 	 */
-	public int indexOf(Object object) {
+	@Override
+    public int indexOf(Object object) {
 		int pos = 0;
 		Link<E> link = voidLink.next;
 		if (object != null) {
 			while (link != voidLink) {
-				if (object.equals(link.data))
-					return pos;
+				if (object.equals(link.data)) {
+                    return pos;
+                }
 				link = link.next;
 				pos++;
 			}
 		} else {
 			while (link != voidLink) {
-				if (link.data == null)
-					return pos;
+				if (link.data == null) {
+                    return pos;
+                }
 				link = link.next;
 				pos++;
 			}
@@ -473,21 +508,24 @@
 	 *            the object to search for
 	 * @return the index of the last occurrence of the object
 	 */
-	public int lastIndexOf(Object object) {
+	@Override
+    public int lastIndexOf(Object object) {
 		int pos = size;
 		Link<E> link = voidLink.previous;
 		if (object != null) {
 			while (link != voidLink) {
 				pos--;
-				if (object.equals(link.data))
-					return pos;
+				if (object.equals(link.data)) {
+                    return pos;
+                }
 				link = link.previous;
 			}
 		} else {
 			while (link != voidLink) {
 				pos--;
-				if (link.data == null)
-					return pos;
+				if (link.data == null) {
+                    return pos;
+                }
 				link = link.previous;
 			}
 		}
@@ -508,7 +546,8 @@
 	 * 
 	 * @see ListIterator
 	 */
-	public ListIterator<E> listIterator(int location) {
+	@Override
+    public ListIterator<E> listIterator(int location) {
 		return new LinkIterator<E>(this, location);
 	}
 
@@ -522,15 +561,18 @@
 	 * @exception IndexOutOfBoundsException
 	 *                when <code>location < 0 || >= size()</code>
 	 */
-	public E remove(int location) {
+	@Override
+    public E remove(int location) {
 		if (0 <= location && location < size) {
 			Link<E> link = voidLink;
 			if (location < (size / 2)) {
-				for (int i = 0; i <= location; i++)
-					link = link.next;
+				for (int i = 0; i <= location; i++) {
+                    link = link.next;
+                }
 			} else {
-				for (int i = size; i > location; i--)
-					link = link.previous;
+				for (int i = size; i > location; i--) {
+                    link = link.previous;
+                }
 			}
 			Link<E> previous = link.previous;
 			Link<E> next = link.next;
@@ -539,21 +581,26 @@
 			size--;
 			modCount++;
 			return link.data;
-		} else
-			throw new IndexOutOfBoundsException();
+		} else {
+            throw new IndexOutOfBoundsException();
+        }
 	}
 
-	public boolean remove(Object object) {
+	@Override
+    public boolean remove(Object object) {
 		Link<E> link = voidLink.next;
 		if (object != null) {
-			while (link != voidLink && !object.equals(link.data))
-				link = link.next;
+			while (link != voidLink && !object.equals(link.data)) {
+                link = link.next;
+            }
 		} else {
-			while (link != voidLink && link.data != null)
-				link = link.next;
+			while (link != voidLink && link.data != null) {
+                link = link.next;
+            }
 		}
-		if (link == voidLink)
-			return false;
+		if (link == voidLink) {
+            return false;
+        }
 		Link<E> next = link.next;
 		Link<E> previous = link.previous;
 		previous.next = next;
@@ -580,8 +627,9 @@
 			size--;
 			modCount++;
 			return first.data;
-		} else
-			throw new NoSuchElementException();
+		} else {
+            throw new NoSuchElementException();
+        }
 	}
 
 	/**
@@ -601,8 +649,9 @@
 			size--;
 			modCount++;
 			return last.data;
-		} else
-			throw new NoSuchElementException();
+		} else {
+            throw new NoSuchElementException();
+        }
 	}
 
 	/**
@@ -618,21 +667,25 @@
 	 * @exception IndexOutOfBoundsException
 	 *                when <code>location < 0 || >= size()</code>
 	 */
-	public E set(int location, E object) {
+	@Override
+    public E set(int location, E object) {
 		if (0 <= location && location < size) {
 			Link<E> link = voidLink;
 			if (location < (size / 2)) {
-				for (int i = 0; i <= location; i++)
-					link = link.next;
+				for (int i = 0; i <= location; i++) {
+                    link = link.next;
+                }
 			} else {
-				for (int i = size; i > location; i--)
-					link = link.previous;
+				for (int i = size; i > location; i--) {
+                    link = link.previous;
+                }
 			}
 			E result = link.data;
 			link.data = object;
 			return result;
-		} else
-			throw new IndexOutOfBoundsException();
+		} else {
+            throw new IndexOutOfBoundsException();
+        }
 	}
 
 	/**
@@ -640,7 +693,8 @@
 	 * 
 	 * @return the number of elements in this LinkedList
 	 */
-	public int size() {
+	@Override
+    public int size() {
 		return size;
 	}
     
@@ -671,7 +725,8 @@
 	 * 
 	 * @return an array of the elements from this LinkedList
 	 */
-	public Object[] toArray() {
+	@Override
+    public Object[] toArray() {
 		int index = 0;
 		Object[] contents = new Object[size];
 		Link<E> link = voidLink.next;
@@ -697,19 +752,22 @@
 	 *                when the type of an element in this LinkedList cannot be
 	 *                stored in the type of the specified array
 	 */
-	public <T> T[] toArray(T[] contents) {
+	@Override
+    @SuppressWarnings("unchecked")
+    public <T> T[] toArray(T[] contents) {
 		int index = 0;
 		if (size > contents.length) {
-            contents = (T[]) Array.newInstance(contents.getClass()
-                    .getComponentType(), size);
+            Class<?> ct = contents.getClass().getComponentType();
+            contents = (T[]) Array.newInstance(ct, size);
         }
 		Link<E> link = voidLink.next;
 		while (link != voidLink) {
 			contents[index++] = (T)link.data;
 			link = link.next;
 		}
-		if (index < contents.length)
-			contents[index] = null;
+		if (index < contents.length) {
+            contents[index] = null;
+        }
 		return contents;
 	}
 
@@ -717,11 +775,13 @@
 		stream.defaultWriteObject();
 		stream.writeInt(size);
 		Iterator<E> it = iterator();
-		while (it.hasNext())
-			stream.writeObject(it.next());
+		while (it.hasNext()) {
+            stream.writeObject(it.next());
+        }
 	}
 
-	private void readObject(ObjectInputStream stream) throws IOException,
+	@SuppressWarnings("unchecked")
+    private void readObject(ObjectInputStream stream) throws IOException,
 			ClassNotFoundException {
 		stream.defaultReadObject();
 		size = stream.readInt();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Observable.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Observable.java?rev=417154&r1=417153&r2=417154&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Observable.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Observable.java Mon Jun 26 03:11:40 2006
@@ -107,6 +107,7 @@
 	 * @param data
 	 *            the argument passed to update()
 	 */
+    @SuppressWarnings("unchecked")
     public void notifyObservers(Object data) {
 		if (changed) {
 			// Must clone the vector in case deleteObserver is called

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/PriorityQueue.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/PriorityQueue.java?rev=417154&r1=417153&r2=417154&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/PriorityQueue.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/PriorityQueue.java Mon Jun 26 03:11:40 2006
@@ -220,6 +220,7 @@
      * @return true if the object is in the priority queue, false if the object
      *         is not in the priority queue.
      */
+    @SuppressWarnings("unchecked")
     public boolean remove(Object o) {
         if (o == null) {
             return false;
@@ -278,6 +279,7 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException,
             ClassNotFoundException {
         in.defaultReadObject();
@@ -288,6 +290,7 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     private E[] newElementArray(int capacity) {
         return (E[]) new Object[capacity];
     }
@@ -300,6 +303,7 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     private void getFromPriorityQueue(PriorityQueue<? extends E> c) {
         initSize(c);
         comparator = (Comparator<? super E>) c.comparator();
@@ -307,6 +311,7 @@
         size = c.size();
     }
 
+    @SuppressWarnings("unchecked")
     private void getFromSortedSet(SortedSet<? extends E> c) {
         initSize(c);
         comparator = (Comparator<? super E>) c.comparator();