This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: Patch: java.util.Hashtable


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi list,


I commited the attached patch to merge with classpath again.


Michael
- -- 
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/zNYlWSOgCCdjSDsRAnq6AKCWPteI+40UNfbBjmON3mYIxzn2aACgnWs+
ND6i/9cBgrdS/Snx0RjiTfU=
=JgFI
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2406
diff -u -b -B -r1.2406 ChangeLog
--- ChangeLog	2 Dec 2003 16:15:14 -0000	1.2406
+++ ChangeLog	2 Dec 2003 17:02:28 -0000
@@ -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  Ito Kazumitsu  <kaz@maczuka.gcd.org>
 
 	* java/text/SimpleDateFormat.java (compileFormat):
Index: java/util/Hashtable.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/Hashtable.java,v
retrieving revision 1.19
diff -u -b -B -r1.19 Hashtable.java
--- java/util/Hashtable.java	26 Nov 2003 21:45:55 -0000	1.19
+++ java/util/Hashtable.java	2 Dec 2003 17:02:28 -0000
@@ -333,7 +333,11 @@
    */
   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);
   }
 
   /**
@@ -349,6 +353,25 @@
    * @since 1.2
    */
   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--)
       {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]