I'm trying to generate a Java class from Clojure with gen-class, but
without much success. I've got the following code:

(ns p.C (:gen-class :methods [[m [Object] void]]))
(defn -m [o] (println (.. o getClass getName)))

The signature of the m method is correct:

javap p.C
public class p.C extends java.lang.Object{
    public static {};
    public p.C();
    public int hashCode();
    public boolean equals(java.lang.Object);
    public java.lang.String toString();
    public java.lang.Object clone();
    public void m(java.lang.Object);
    public static void main(java.lang.String[]);
}

But when I try to call the method, I get the following exception:

NativeException: java.lang.IllegalArgumentException: Wrong number of
args passed to: C$-m
        from clojure/lang/AFn.java:469:in `throwArity'
        from clojure/lang/AFn.java:76:in `invoke'
        from p.C:-1:in `m'
        from sun/reflect/NativeMethodAccessorImpl.java:-2:in `invoke0'
        from sun/reflect/NativeMethodAccessorImpl.java:39:in `invoke'
        from sun/reflect/DelegatingMethodAccessorImpl.java:25:in `invoke'
        from java/lang/reflect/Method.java:597:in `invoke'
...

What's going on?

Also, can somebody give an example of a gen-class call that specifies:
- a static method
- a method with an array among the parameters.

Cheers,

Michiel de Mare
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to