|
From: <no...@so...> - 2000-12-16 20:52:19
|
Bug #122819, was updated on 2000-Nov-18 11:11
Here is a current snapshot of the bug.
Project: Jython
Category: Core
Status: Open
Resolution: None
Bug Group: None
Priority: 4
Submitted by: bckfnn
Assigned to : nobody
Summary: Multi-level Java method overriding fails
Details: Consider the following script --
==========
#!/usr/bin/env jpython
from java.util import Date
class SubDate(Date):
def toString(self): return 'SubDate.toString() -> ' + Date.toString(self)
class SubSubDate(SubDate):
def toString(self): return 'SubSubDate.toString() -> ' +
SubDate.toString(self)
print Date().toString()
print SubDate().toString()
print SubSubDate().toString()
==========
The output is as follows --
==========
Fri Oct 22 12:53:58 CDT 1999
SubDate.toString() -> Fri Oct 22 12:53:58 CDT 1999
Traceback (innermost last):
File "test.py", line 12, in ?
File "test.py", line 8, in toString
File "test.py", line 6, in toString
java.lang.StackOverflowError
at org.python.core.PyClass.lookupGivingClass(PyClass.java:137)
at org.python.core.PyJavaClass.lookupGivingClass(PyJavaClass.java:673)
at org.python.core.PyClass.lookup(PyClass.java:155)
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:132)
< ... >
at org.python.proxies.SubDate$0.toString(Unknown Source)
at org.python.proxies.SubSubDate$1.super__toString(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:156)
< ... >
at org.python.proxies.SubDate$0.toString(Unknown Source)
at org.python.proxies.SubSubDate$1.super__toString(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:156)
< ... >
at org.python.util.jpython.main(jpython.java:123)
==========
What seems to happen is that SubSubDate.toString() calls SubDate.toString()
calls Date.toString() ... which then turns around and calls the derived-most
implementation of toString() all over again, ie, the one at SubSubDate. This
goes on and on until the above stack overflow occurs.
Note that with only one level of inheritance, ie, calling SubDate.toString(),
it worked correctly with no problems.
I originally observed this problem with overriding
java.lang.Thread.interrupt(),
so the above simplified test case has been reproduced elsewhere.
I can reproduce this with Sun Solaris JDK versions 1.3, 1.2.2 and 1.1.8.
Follow-Ups:
Date: 2000-Dec-16 12:52
By: pedronis
Comment:
Just checked that the nasty bug is still there.
It should be solved for sure, at least the
stack overflow.
Not analyzed yet.
-------------------------------------------------------
For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=122819&group_id=12867
|