Kaydet (Commit) 450bf77d authored tarafından Michael Stahl's avatar Michael Stahl

ridljar: partially revert 4418ad03

It looks like this changes a class interface that is likely part of the
URE ABI; removing an interface seems risky to me.

Change-Id: I90efbbdbc6ef029dd6a4e6926f6031d56ffbb10a
üst 02bb9c54
...@@ -57,8 +57,12 @@ import java.util.Set; ...@@ -57,8 +57,12 @@ import java.util.Set;
* <code>DisposeNotifier</code> interface. For those that do, the associated * <code>DisposeNotifier</code> interface. For those that do, the associated
* <code>WeakReference</code> wrappers are automatically cleared as soon as the * <code>WeakReference</code> wrappers are automatically cleared as soon as the
* values are disposed.</p> * values are disposed.</p>
*
* Note that this class does not actually implement the Map interface properly,
* the type of the return value of the entrySet and values methods is wrong,
* but the "implements Map" is retained for backward compatibility.
*/ */
public final class WeakMap<K,V> { public final class WeakMap<K,V> implements Map {
/** /**
* Declare the map as WeakReference instead of Entry because it makes the return * Declare the map as WeakReference instead of Entry because it makes the return
...@@ -116,7 +120,7 @@ public final class WeakMap<K,V> { ...@@ -116,7 +120,7 @@ public final class WeakMap<K,V> {
* @return <code>true</code> if this map contains a mapping for the * @return <code>true</code> if this map contains a mapping for the
* specified key * specified key
*/ */
public boolean containsKey(K key) { public boolean containsKey(/*K*/ Object key) {
return map.containsKey(key); return map.containsKey(key);
} }
...@@ -130,7 +134,7 @@ public final class WeakMap<K,V> { ...@@ -130,7 +134,7 @@ public final class WeakMap<K,V> {
* @return <code>true</code> if this map maps one or more keys to the * @return <code>true</code> if this map maps one or more keys to the
* specified value * specified value
*/ */
public boolean containsValue(WeakReference<V> value) { public boolean containsValue(Object /*WeakReference<V>*/ value) {
return map.containsValue(value); return map.containsValue(value);
} }
...@@ -145,7 +149,7 @@ public final class WeakMap<K,V> { ...@@ -145,7 +149,7 @@ public final class WeakMap<K,V> {
* @return the value to which this map maps the specified key, or * @return the value to which this map maps the specified key, or
* <code>null</code> if the map contains no mapping for this key * <code>null</code> if the map contains no mapping for this key
*/ */
public WeakReference<V> get(K key) { public WeakReference<V> get(/*K*/ Object key) {
return map.get(key); return map.get(key);
} }
...@@ -161,9 +165,9 @@ public final class WeakMap<K,V> { ...@@ -161,9 +165,9 @@ public final class WeakMap<K,V> {
* @return previous value associated with the specified key, or * @return previous value associated with the specified key, or
* <code>null</code> if there was no mapping for the key * <code>null</code> if there was no mapping for the key
*/ */
public WeakReference<V> put(K key, V value) { public Object /*WeakReference<V>*/ put(/*K*/ Object key, /*V*/ Object value) {
cleanUp(); cleanUp();
return map.put(key, new Entry<K,V>(key, value, queue)); return map.put((K) key, new Entry<K,V>((K) key, (V) value, queue));
} }
/** /**
...@@ -175,7 +179,7 @@ public final class WeakMap<K,V> { ...@@ -175,7 +179,7 @@ public final class WeakMap<K,V> {
* @return previous value associated with the specified key, or * @return previous value associated with the specified key, or
* <code>null</code> if there was no mapping for the key * <code>null</code> if there was no mapping for the key
*/ */
public WeakReference<V> remove(K key) { public Object /*WeakReference<V>*/ remove(/*K*/ Object key) {
cleanUp(); cleanUp();
return map.remove(key); return map.remove(key);
} }
...@@ -189,7 +193,7 @@ public final class WeakMap<K,V> { ...@@ -189,7 +193,7 @@ public final class WeakMap<K,V> {
* must be plain objects, which are then wrapped in instances of * must be plain objects, which are then wrapped in instances of
* <code>WeakReference</code>. * <code>WeakReference</code>.
*/ */
public void putAll(Map<K,V> m) { public void putAll(Map/*<K,V>*/ m) {
cleanUp(); cleanUp();
for (Iterator<Map.Entry<K,V>> i = m.entrySet().iterator(); i.hasNext();) { for (Iterator<Map.Entry<K,V>> i = m.entrySet().iterator(); i.hasNext();) {
Map.Entry<K,V> e = i.next(); Map.Entry<K,V> e = i.next();
...@@ -237,7 +241,7 @@ public final class WeakMap<K,V> { ...@@ -237,7 +241,7 @@ public final class WeakMap<K,V> {
* *
* @return a collection view of the mappings contained in this map * @return a collection view of the mappings contained in this map
*/ */
public Set<Map.Entry<K,WeakReference<V>>> entrySet() { public Set/*<Map.Entry<K,WeakReference<V>>>*/ entrySet() {
return map.entrySet(); return map.entrySet();
} }
...@@ -261,8 +265,8 @@ public final class WeakMap<K,V> { ...@@ -261,8 +265,8 @@ public final class WeakMap<K,V> {
* @return the referent of the specified <code>WeakReference</code>, or * @return the referent of the specified <code>WeakReference</code>, or
* <code>null</code> if <code>ref</code> is <code>null</code> * <code>null</code> if <code>ref</code> is <code>null</code>
*/ */
public static <T> T getValue(WeakReference<T> ref) { public static <T> T getValue(Object /*WeakReference<T>*/ ref) {
return ref == null ? null : ref.get(); return ref == null ? null : ((WeakReference<T>) ref).get();
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment