diff options
author | Pekka Enberg <penberg@kernel.org> | 2011-02-22 16:10:17 +0000 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2011-02-22 16:10:17 +0000 |
commit | f154af643a6909a062df3051084da49651d720e6 (patch) | |
tree | 9f7f328355b1e8efcfb9b9cc7bbe033ab038fddd /java/util | |
parent | 91debbc6aae04e6201172303bdb8be952058301a (diff) | |
download | classpath-f154af643a6909a062df3051084da49651d720e6.tar.gz |
Fix HashMap.put() to check for hashCode equality before equals()
This patch is needed to run Jython 2.5.2 RC 4 under JamVM and GNU Classpath CVS
HEAD. It turns out Jythin bootstrap is bit hairy and assumes HashMap.put()
checks for hashCode equality before invoking Object.equals().
2011-02-22 Pekka Enberg <penberg@kernel.org>
* java/util/HashMap:
(put): Check for key hashCode equality before invoking
Object.equals() to fix compatibility issue with Jython.
Diffstat (limited to 'java/util')
-rw-r--r-- | java/util/HashMap.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/java/util/HashMap.java b/java/util/HashMap.java index d7a9a7f5b..9d64fecb4 100644 --- a/java/util/HashMap.java +++ b/java/util/HashMap.java @@ -345,7 +345,7 @@ public class HashMap<K, V> extends AbstractMap<K, V> while (e != null) { - if (equals(key, e.key)) + if ((key.hashCode() == e.key.hashCode()) && equals(key, e.key)) { e.access(); // Must call this for bookkeeping in LinkedHashMap. V r = e.value; |