Hi all,
attached is my fix to make ant (I think) work again with Classpath, fixing the bug reported by Jim Pick here [1]
Citing myself [2]:
this is a typical java library bug, and I've both produced and fixed a couple of those myself ;) You get an infinite recursion through calling overridden methods. Class A in library implements public methods b and c, where b internally (and of course undocumentedly ;) calls c. Class B from some user of the library extends A and overrides c to call b. When the user calls the method b of class B it goes straight into an infinite loop.
The fix is to avoid calling overridable methods from overridable methods, and to delegate those calls to internal, non-overridable versions of the methods.
2003-11-21 Dalibor Topic <[EMAIL PROTECTED]>
* libraries/javalib/java/util/Hashtable.java: (internalcontainsValue) new method. (contains, containsValue) delegate to internalContainsValue.
Reported by: Jim Pick <[EMAIL PROTECTED]>
cheers, dalibor topic
[1] http://mail.gnu.org/archive/html/classpath/2003-09/msg00009.html [2] http://mail.gnu.org/archive/html/classpath/2003-09/msg00016.html
And this time, I even attached the patch! ;)
cheers, dalbor topic
--- /var/tmp/PROJECTS/classpath//./java/util/Hashtable.java Wed Nov 12 21:56:20
2003
+++ /tmp/topic/kaffe/libraries/javalib/java/util/Hashtable.java Fri Oct 10 18:49:09
2003
@@ -333,7 +333,10 @@
*/
public synchronized boolean contains(Object value)
{
- return containsValue(value);
+ /* delegate to non-overridable worker method
+ * to avoid blowing up the stack.
+ */
+ return internalContainsValue(value);
}
/**
@@ -349,6 +352,25 @@
* @since 1.2
*/
public boolean containsValue(Object value)
+ {
+ /* delegate to non-overridable worker method
+ * to avoid blowing up the stack.
+ */
+ return internalContainsValue(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--)
{
_______________________________________________ Classpath mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/classpath

