This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

problems with subclass


Hi all!

I'm trying to subclass a Java class but it doesn't work correctly. What i'm doing si like this:

Java class:

public abstrac AntQueen {
...
public void move(){
}


}



I need to extend this class to write de move, but in scheme. I do this:

(define-simple-class <FunctionalAntQueen> (<engine.AntQueen>)
((*init*)
(display "hola")
)
)
and compile it with:


$ java -cp . kawa.repl -P colony. -C ../../src/colony/FunctionalAntQueen.scm

In that state, when I try to load it from java:

try {

//ContestEngine ce = new ContestEngine();
Object preAnt = Class.forName("colony.FunctionalAntQueen").newInstance();
//TestAQ aq = new TestAQ();
if (preAnt instanceof AntQueen) {
System.out.println("SIIII!");
((AntQueen)preAnt).move();
}
else
System.out.println("NOOOO!!!");


.... ....


it trow:


Exception in thread "main" java.lang.NoSuchFieldError: Lit0
at colony.FunctionalAntQueen.<init>(FunctionalAntQueen.scm:8)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at pruebas.Main.main(Main.java:46)
Java Result: 1



If the constructor do not have any call (without the display line) it work, but any change throw an exeption.


What I do wrong?

Thank

Marcelo




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]