Message806

Author gedb
Recipients
Date 2003-01-07.10:02:14
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
I'm having some problems extending an abstract Java 
class.  Everything is fine, except when the extended 
class is called from within the constructor.

First of all is my Abstract Java class.

-----------------------------------------------------------
01 public abstract class Abstract {
02
03    public Abstract() {
04       System.out.println("Java Class Abstract
Constructing");
05       // showInt(5);
06       System.out.println("Java Class Abstract
Constructed");
07    }
08
09    public abstract void showInt(int i);
10
11    public void showSix() {
12       showInt(6);
13    }
10 }
---------------------------------------------
Abstract.java

My Jython script looks like this.
-----------------------------------------------------------
01 import Abstract
02
03 class extends(Abstract):
04
05    def __init__(self):
06       print "Jython class 'extends' initialised"
07
08    def showInt(self, i):
09       print "showInt called with : ", i
10
11
12 x = extends()
13 x.showInt(6)
14 x.showSix()
------------------------------------------------
Extends.jy

The output is as expected:

Jython class 'extends' initialised
Java Class Abstract Constructing
Java Class Abstract Constructed
showInt called with :  6
showInt called with :  6

However, if I decomment line 5 in Abstract.java, so that 
the system attempts to call the abstract method in the 
constructor the output is an error:

Jython class 'extends' initialised
Java Class Abstract Constructing
Traceback (innermost last):
  File "D:\gedbs\Java\lib\uk\co\RushCoding\extend.jy",
line 12, in ?
AttributeError: abstract method "showInt" not
implemented
History
Date User Action Args
2008-02-20 17:17:13adminlinkissue663592 messages
2008-02-20 17:17:13admincreate