diff options
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 16 | ||||
-rw-r--r-- | libjava/java/util/Hashtable.java | 25 |
2 files changed, 40 insertions, 1 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 6085708..d97672f 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,19 @@ +2003-12-02 Dalibor Topic <robilad@kaffe.org> + + Reported by: Jim Pick <jim@kaffe.org> + * libraries/javalib/java/util/Hashtable.java + (internalcontainsValue): New method. + (contains): Delegate to internalContainsValue. + + Reported by: Mark Wielaard <mark@klomp.org> + * libraries/javalib/java/util/Hashtable.java + (contains): Improved comment. + + Reported by: Jeroen Frijters <jeroen@frijters.net> + * libraries/javalib/java/util/Hashtable.java + (containsValue): Delegate to contains(Object) to make sure older + code overwriting it continues to work. + 2003-12-02 Fernando Nasser <fnasser@redhat.com> * gnu/java/awt/peer/gtk/GtkListPeer.java (handleEvent): New diff --git a/libjava/java/util/Hashtable.java b/libjava/java/util/Hashtable.java index b0de0a2..d19b2fb 100644 --- a/libjava/java/util/Hashtable.java +++ b/libjava/java/util/Hashtable.java @@ -333,7 +333,11 @@ public class Hashtable extends Dictionary */ public synchronized boolean contains(Object value) { - return containsValue(value); + /* delegate to non-overridable worker method + * to avoid blowing up the stack, when called + * from overridden contains[Value]() method. + */ + return internalContainsValue(value); } /** @@ -350,6 +354,25 @@ public class Hashtable extends Dictionary */ public boolean containsValue(Object value) { + /* delegate to older method to make sure code overwriting it + * continues to work. + */ + return contains(value); + } + + /** + * Returns true if this Hashtable contains a value <code>o</code>, such that + * <code>o.equals(value)</code>. This is an internal worker method + * called by <code>contains()</code> and <code>containsValue()</code>. + * + * @param value the value to search for in this Hashtable + * @return true if at least one key maps to the value + * @see #contains(Object) + * @see #containsKey(Object) + * @throws NullPointerException if <code>value</code> is null + */ + private boolean internalContainsValue(Object value) + { for (int i = buckets.length - 1; i >= 0; i--) { HashEntry e = buckets[i]; |