You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sm...@apache.org on 2006/05/19 05:41:14 UTC

svn commit: r407699 - in /incubator/harmony/enhanced/classlib/trunk/modules: luni-kernel/src/main/java/java/lang/ref/ luni/src/main/java/java/util/

Author: smishura
Date: Thu May 18 20:41:14 2006
New Revision: 407699

URL: http://svn.apache.org/viewvc?rev=407699&view=rev
Log:
Apply one of patches for HARMONY-471 (Integration of ITC rmi implementaion (jsr14 version))

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/WeakReference.java
    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/LinkedHashSet.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/WeakHashMap.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/WeakReference.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/WeakReference.java?rev=407699&r1=407698&r2=407699&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/WeakReference.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/WeakReference.java Thu May 18 20:41:14 2006
@@ -21,7 +21,7 @@
  * 
  * @since JDK1.2
  */
-public class WeakReference extends java.lang.ref.Reference {
+public class WeakReference<T> extends java.lang.ref.Reference<T> {
 
 	/**
 	 * Constructs a new instance of this class.
@@ -32,7 +32,7 @@
 	 * @param q
 	 *            queue to register to the reference object with.
 	 */
-	public WeakReference(Object r, ReferenceQueue q) {
+	public WeakReference(T r, ReferenceQueue<? super T> q) {
 		initReference(r, q);
 	}
 
@@ -43,7 +43,7 @@
 	 * @param r
 	 *            referent to track.
 	 */
-	public WeakReference(Object r) {
+	public WeakReference(T r) {
 		initReference(r);
 	}
 }

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=407699&r1=407698&r2=407699&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 Thu May 18 20:41:14 2006
@@ -24,8 +24,8 @@
  * HashMap is an implementation of Map. All optional operations are supported,
  * adding and removing. Keys and values can be any objects.
  */
-public class HashMap extends AbstractMap implements Map, Cloneable,
-		Serializable {
+public class HashMap<K,V> extends AbstractMap<K,V> implements Map<K,V>,
+                Cloneable, Serializable {
 	private static final long serialVersionUID = 362498820763181265L;
 
 	transient int elementCount;
@@ -40,12 +40,12 @@
 
 	private static final int DEFAULT_SIZE = 16;
 
-	static class Entry extends MapEntry {
+    static class Entry<K,V> extends MapEntry<K,V> {
 		final int hash;
 
-		Entry next;
+                Entry<K,V> next;
 
-		Entry(Object theKey, Object theValue) {
+		Entry(K theKey, V theValue) {
 			super(theKey, theValue);
 			this.hash = (theKey == null) ? 0 : theKey.hashCode();
 		}
@@ -375,8 +375,8 @@
 	 *            the key
 	 * @return the value of the mapping with the specified key
 	 */
-	public Object get(Object key) {
-		Entry m = getEntry(key);
+	public V get(Object key) {
+                Entry<K,V> m = getEntry(key);
 		if (m != null) {
 			return m.value;
 		}
@@ -426,7 +426,7 @@
 	 * 
 	 * @return a Set of the keys
 	 */
-	public Set keySet() {
+	public Set<K> keySet() {
 		if (keySet == null) {
 			keySet = new AbstractSet() {
 				public boolean contains(Object object) {
@@ -535,8 +535,8 @@
 	 * @return the value of the removed mapping or null if key is not a key in
 	 *         this HashMap
 	 */
-	public Object remove(Object key) {
-		Entry entry = removeEntry(key);
+	public V remove(Object key) {
+                Entry<K,V> entry = removeEntry(key);
 		if (entry != null) {
 			return entry.value;
 		}
@@ -588,7 +588,7 @@
 	 * 
 	 * @return a Collection of the values
 	 */
-	public Collection values() {
+	public Collection<V> values() {
 		if (valuesCollection == null) {
 			valuesCollection = new AbstractCollection() {
 				public boolean contains(Object object) {

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=407699&r1=407698&r2=407699&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 Thu May 18 20:41:14 2006
@@ -27,7 +27,7 @@
  * Like HashSet, LinkedHashSet is not thread safe, so access by multiple threads must be synchronized
  * by an external mechanism such as Collections.synchronizedSet.
  */
-public class LinkedHashSet extends HashSet implements Set, Cloneable,
+public class LinkedHashSet<E> extends HashSet<E> implements Set<E>, Cloneable,
 		Serializable {
 	
 	private static final long serialVersionUID = -2851667679971038690L;
@@ -69,7 +69,7 @@
 	 * @param collection
 	 *            the collection of elements to add
 	 */
-	public LinkedHashSet(Collection collection) {
+	public LinkedHashSet(Collection<? extends E> collection) {
 		super(new LinkedHashMap(collection.size() < 6 ? 11
 				: collection.size() * 2));
 		Iterator it = collection.iterator();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/WeakHashMap.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/WeakHashMap.java?rev=407699&r1=407698&r2=407699&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/WeakHashMap.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/WeakHashMap.java Thu May 18 20:41:14 2006
@@ -24,7 +24,7 @@
  * optional operations are supported, adding and removing. Keys and values can
  * be any objects.
  */
-public class WeakHashMap extends AbstractMap implements Map {
+public class WeakHashMap<K,V> extends AbstractMap<K,V> implements Map<K,V> {
 
 	private final ReferenceQueue referenceQueue;
 
@@ -40,12 +40,12 @@
 
 	private static final int DEFAULT_SIZE = 16;
 
-	private static final class Entry extends WeakReference implements Map.Entry {
+        private static final class Entry<K,V> extends WeakReference<K> implements Map.Entry<K,V> {
 		int hash;
 
 		boolean isNull;
 
-		Object value;
+		V value;
 
 		Entry next;
 
@@ -53,23 +53,23 @@
 			Object get(Map.Entry entry);
 		}
 
-		Entry(Object key, Object object, ReferenceQueue queue) {
+		Entry(K key, V object, ReferenceQueue<? super K> queue) {
 			super(key, queue);
 			isNull = key == null;
 			hash = isNull ? 0 : key.hashCode();
 			value = object;
 		}
 
-		public Object getKey() {
+		public K getKey() {
 			return super.get();
 		}
 
-		public Object getValue() {
+		public V getValue() {
 			return value;
 		}
 
-		public Object setValue(Object object) {
-			Object result = value;
+		public V setValue(V object) {
+			V result = value;
 			value = object;
 			return result;
 		}
@@ -388,11 +388,11 @@
 	 *            the key
 	 * @return the value of the mapping with the specified key
 	 */
-	public Object get(Object key) {
+	public V get(Object key) {
 		poll();
 		if (key != null) {
 			int index = (key.hashCode() & 0x7FFFFFFF) % elementData.length;
-			Entry entry = elementData[index];
+			Entry<K,V> entry = elementData[index];
 			while (entry != null) {
 				if (key.equals(entry.get()))
 					return entry.value;
@@ -400,7 +400,7 @@
 			}
 			return null;
 		}
-		Entry entry = elementData[0];
+		Entry<K,V> entry = elementData[0];
 		while (entry != null) {
 			if (entry.isNull)
 				return entry.value;
@@ -574,10 +574,10 @@
 	 * @return the value of the removed mapping or null if key is not a key in
 	 *         this WeakHashMap
 	 */
-	public Object remove(Object key) {
+	public V remove(Object key) {
 		poll();
 		int index = 0;
-		Entry entry, last = null;
+		Entry<K,V> entry, last = null;
 		if (key != null) {
 			index = (key.hashCode() & 0x7FFFFFFF) % elementData.length;
 			entry = elementData[index];