You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/07/04 11:31:35 UTC
svn commit: r418963 - in
/incubator/harmony/enhanced/classlib/trunk/modules/luni/src:
main/java/java/util/HashMap.java
test/java/tests/api/java/util/HashMapTest.java
Author: tellison
Date: Tue Jul 4 02:31:34 2006
New Revision: 418963
URL: http://svn.apache.org/viewvc?rev=418963&view=rev
Log:
*Rolling back* : Apply patch and additional fixes for HARMONY-403: HashMap hashcode ignores values in entries
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashMap.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/HashMapTest.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=418963&r1=418962&r2=418963&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 Tue Jul 4 02:31:34 2006
@@ -47,8 +47,7 @@
Entry(K theKey, V theValue) {
super(theKey, theValue);
- this.hash = (theKey == null ? 0 : theKey.hashCode())
- ^ (theValue == null ? 0 : theValue.hashCode());
+ this.hash = (theKey == null) ? 0 : theKey.hashCode();
}
@Override
@@ -524,11 +523,8 @@
index = key == null ? 0 : (key.hashCode() & 0x7FFFFFFF)
% elementData.length;
}
- entry = createEntry(key, index, value);
- //new entry, so nothing is replaced
- return null;
+ entry = createEntry(key, index, null);
}
-
V result = entry.value;
entry.value = value;
return result;
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/HashMapTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/HashMapTest.java?rev=418963&r1=418962&r2=418963&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/HashMapTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/HashMapTest.java Tue Jul 4 02:31:34 2006
@@ -409,20 +409,6 @@
return key == ((ReusableKey) o).key;
}
}
-
- public void test_hashCode() {
- HashMap map = new HashMap(10);
- Integer key = new Integer(1);
- Integer val = new Integer(2);
- map.put(key, val);
- int expected = key.hashCode() ^ val.hashCode();
- assertEquals(expected, map.hashCode());
- key = new Integer(4);
- val = new Integer(8);
- map.put(key, val);
- expected += key.hashCode() ^ val.hashCode();
- assertEquals(expected, map.hashCode());
- }
/**
* Sets up the fixture, for example, open a network connection. This method