Message822

Author nobody
Recipients
Date 2003-04-01.15:32:05
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Given an abstract java class with the following excerpt:
<JAVA CODE>
protected Operator(String title){
  this.title=title;
  this.parameters=new Vector();
  setDefaultParameters();
}

abstract public void setDefaultParameters();
</JAVA CODE>

Then subclass this with the following in jython
<JYTHON CODE>
class pyTest(Operator):
    def setDefaultParameters(self):
        print "in SDP"

    def __init__(self):
        self.setDefaultParameters()

if __name__ == "__main__":
    tester=pyTest()
</JYTHON CODE>

This generates an error when you run the script through jython
<ERROR>
Traceback (innermost last):
  File ".../pyTest.py", line 23, in ?
TypeError: Default constructor failed for Java superclass Operator
</ERROR>

It appears that jython is not truly overriding the default methods in the class.

pfpeterson@anl.gov
History
Date User Action Args
2008-02-20 17:17:14adminlinkissue713373 messages
2008-02-20 17:17:14admincreate