--- old/src/share/classes/java/util/IdentityHashMap.java 2011-12-03 15:57:57.862388687 +0100 +++ new/src/share/classes/java/util/IdentityHashMap.java 2011-12-03 15:57:57.725388701 +0100 @@ -327,6 +327,7 @@ * * @see #put(Object, Object) */ + @SuppressWarnings("unchecked") public V get(Object key) { Object k = maskNull(key); Object[] tab = table; @@ -431,7 +432,8 @@ Object item; while ( (item = tab[i]) != null) { if (item == k) { - V oldValue = (V) tab[i + 1]; + @SuppressWarnings("unchecked") + V oldValue = (V) tab[i + 1]; tab[i + 1] = value; return oldValue; } @@ -524,7 +526,8 @@ if (item == k) { modCount++; size--; - V oldValue = (V) tab[i + 1]; + @SuppressWarnings("unchecked") + V oldValue = (V) tab[i + 1]; tab[i + 1] = null; tab[i] = null; closeDeletion(i); @@ -638,7 +641,7 @@ if (o == this) { return true; } else if (o instanceof IdentityHashMap) { - IdentityHashMap m = (IdentityHashMap) o; + IdentityHashMap m = (IdentityHashMap) o; if (m.size() != size) return false; @@ -650,7 +653,7 @@ } return true; } else if (o instanceof Map) { - Map m = (Map)o; + Map m = (Map)o; return entrySet().equals(m.entrySet()); } else { return false; // o is not a Map @@ -698,7 +701,7 @@ */ public Object clone() { try { - IdentityHashMap m = (IdentityHashMap) super.clone(); + IdentityHashMap m = (IdentityHashMap) super.clone(); m.entrySet = null; m.table = table.clone(); return m; @@ -768,7 +771,7 @@ int len = tab.length; int d = deletedSlot; - K key = (K) tab[d]; + Object key = tab[d]; tab[d] = null; // vacate the slot tab[d + 1] = null; @@ -818,12 +821,14 @@ } private class KeyIterator extends IdentityHashMapIterator { + @SuppressWarnings("unchecked") public K next() { return (K) unmaskNull(traversalTable[nextIndex()]); } } private class ValueIterator extends IdentityHashMapIterator { + @SuppressWarnings("unchecked") public V next() { return (V) traversalTable[nextIndex() + 1]; } @@ -854,16 +859,19 @@ this.index = index; } + @SuppressWarnings("unchecked") public K getKey() { checkIndexForEntryUse(); return (K) unmaskNull(traversalTable[index]); } + @SuppressWarnings("unchecked") public V getValue() { checkIndexForEntryUse(); return (V) traversalTable[index+1]; } + @SuppressWarnings("unchecked") public V setValue(V value) { checkIndexForEntryUse(); V oldValue = (V) traversalTable[index+1]; @@ -880,7 +888,7 @@ if (!(o instanceof Map.Entry)) return false; - Map.Entry e = (Map.Entry)o; + Map.Entry e = (Map.Entry)o; return (e.getKey() == unmaskNull(traversalTable[index]) && e.getValue() == traversalTable[index+1]); } @@ -1109,13 +1117,13 @@ public boolean contains(Object o) { if (!(o instanceof Map.Entry)) return false; - Map.Entry entry = (Map.Entry)o; + Map.Entry entry = (Map.Entry)o; return containsMapping(entry.getKey(), entry.getValue()); } public boolean remove(Object o) { if (!(o instanceof Map.Entry)) return false; - Map.Entry entry = (Map.Entry)o; + Map.Entry entry = (Map.Entry)o; return removeMapping(entry.getKey(), entry.getValue()); } public int size() { @@ -1213,8 +1221,10 @@ // Read the keys and values, and put the mappings in the table for (int i=0; i