Issue713373

classification
Title: subclassing abstract class
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: fwierzbicki, nobody, ype
Priority: normal Keywords:

Created on 2003-04-01.15:32:05 by anonymous, last changed 2005-10-31.18:12:43 by fwierzbicki.

Messages
msg822 (view) Author: Nobody/Anonymous (nobody) Date: 2003-04-01.15:32:05
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
msg823 (view) Author: Ype (ype) Date: 2003-05-04.11:50:15
Logged In: YES 
user_id=125722

Here the Java superclass Operator has a constructor  
that takes a String argument, and this constructor is not  
called from the jython test code.  
  
So the TypeError produced by Jython is correct, ie. this is not a 
bug.  
  
I don't know whether it is possible to call a protected 
constructor of an abstract java class from jython. 
 
msg824 (view) Author: Nobody/Anonymous (nobody) Date: 2003-05-09.20:17:38
Logged In: NO 

This is actually a repeat of 663592. See that bug report for a better description 
of what is going on.

pfpeterson@anl.gov
msg825 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2005-10-31.18:12:43
Logged In: YES 
user_id=193969

dup of 663592 -- closing
History
Date User Action Args
2003-04-01 15:32:05anonymouscreate