From: Christian H. <ch...@nu...> - 2001-01-10 16:59:07
|
Hi, we have a Java library that uses the following construct over and over: public class Superclass { private Foo m_foo; // where Foo is some kind of class. public Superclass() { m_foo = createFoo(); } protected Foo createFoo() { return new Foo(); // Return some default foo... } } // To configure Superclass differently, derive from it and override // its create* methods. public class Subclass extends Superclass { protected Foo createFoo() { // Return some other kind of Foo... return new Superfoo(42); } } Now, I'd like to be able to use Jython to do prototyping using that Java library, which means I'd like to be able to write Subclass in python... Unfortunately, it seems that when the virtual method call createFoo() is resolved in the constructor, the lookup mechanism doesn't go all the way down to the python subclasses, it stops at the last java class. Is this a known bug? Is there a way to fix this?? I'd really like to use jython for prototyping work, but I can't because of this bug... Making createFoo public doesn't change anything. I'm running jython 2.0beta1 with Sun's 1.3.0 JDK, if it matters. Thanks in advance, Christian PS Attached are two java files and one python file that demonstrate this bug. |