This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Help, writing kawa equivalent of java program
- From: Vasantha Ganesh <vasanthaganesh dot k at gmail dot com>
- To: kawa at sourceware dot org
- Date: Sat, 1 Apr 2017 21:24:12 +0530
- Subject: Help, writing kawa equivalent of java program
- Authentication-results: sourceware.org; auth=none
Hello all,
Take this Java program:
public class Notworking{
public interface kittens {
public int a();
}
public static void main(String[] args) {
System.out.println(kittens.class);
}
}
and this Kawa program:
(define-simple-class kittens ()
(make-interface #t)
(a::long))
(display kittens:class)
I think both are equivalent, but kawa seems to think that I'm doing a
type cast and throws this error message:
Argument #1 'class kittens' to 'gnu.bytecode.Type.getReflectClass()'
has wrong type (class) (java.lang.Class cannot be cast to
gnu.bytecode.Type)
at not_working.run(not_working.scm:5)
at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:317)
at gnu.expr.CompiledModule.evalModule(CompiledModule.java:42)
at gnu.expr.CompiledModule.evalModule(CompiledModule.java:61)
at kawa.Shell.runFile(Shell.java:538)
at kawa.Shell.runFileOrClass(Shell.java:447)
at kawa.repl.main(repl.java:881)
Caused by: java.lang.ClassCastException: java.lang.Class cannot be
cast to gnu.bytecode.Type
... 7 more
but if I do this in repl, I think its working:
#|kawa:1|# (define-simple-class kittens ()
#|(---:2|# (make-interface #t)
#|(---:3|# (a::long))
#|kawa:4|# (display kittens:class)
class kittens
Thank you,
Vasantha Ganesh K.