Marcelo D. RÃ wrote:
I'm trying to subclass a Java class but it doesn't work
correctly. ....
Exception in thread "main" java.lang.NoSuchFieldError: Lit0
at colony.FunctionalAntQueen.<init>(FunctionalAntQueen.scm:8)
The problem is probably because the FunctionalAntQueen class is not
self-contained, but depends on the enclosing "module class", which
contains top-level definitions (none in this case, except the
FunctionalAntQueen) and compiler-generated members such as literals.
You probably want to compile using the flag --module-static-run
command-line option, or (equivalently) put (module-static 'init-run)
in your file. See
http://www.gnu.org/software/kawa/Compilation-options.html
http://www.gnu.org/software/kawa/Module-classes.html#id2600899
It looks like things are further messed up because the name of the
module class is the same as the define-simple-class. Kawa doesn't
handle this well. (I vaguely remember putting in a test for this
in SVN Kawa, but I'm not sure.)
You could try putting something like
(module-name FunctionalAntQueenModule)
in your .scm file.