public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* Help, writing kawa equivalent of java program
@ 2017-04-01 15:54 Vasantha Ganesh
  2017-04-01 16:28 ` Per Bothner
  0 siblings, 1 reply; 10+ messages in thread
From: Vasantha Ganesh @ 2017-04-01 15:54 UTC (permalink / raw)
  To: kawa

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-04-02  5:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-01 15:54 Help, writing kawa equivalent of java program Vasantha Ganesh
2017-04-01 16:28 ` Per Bothner
2017-04-01 19:44   ` Vasantha Ganesh
2017-04-01 19:52     ` Per Bothner
2017-04-01 19:59       ` Vasantha Ganesh
2017-04-01 20:00         ` Vasantha Ganesh
2017-04-01 20:20           ` Sudarshan S Chawathe
2017-04-01 20:25             ` Per Bothner
2017-04-01 20:51               ` Vasantha Ganesh
2017-04-02  5:39   ` Per Bothner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).