(sorry, the first message got sent before it was actually done. butterfingers.)


Hi all!

My new goal in life is to learn my way around the SVNKit API, using
Clojure. It didn't take me long to reach the first stumbling block:

Here's the situation:

The class SVNCommitClient [1] defines two overloads of doMkDir. I'm
trying to call the two argument version:

   SVNCommitInfo doMkDir(SVNURL[] urls, String commitMessage)

[1] http://svnkit.com/javadoc/org/tmatesoft/svn/core/wc/SVNCommitClient.html

Instead of getting back and SVNCommitInfo, I'm getting an exception
out of the bowels of the compiler telling me that it can not resolve
the method:

   No matching method found: doMkdir for class
org.tmatesoft.svn.core.wc.SVNCommitClient
     [Thrown class java.lang.IllegalArgumentException]

Here's what I'm trying to do:

(ns bpsmithmannschott.svnkit
  (:import
   [org.tmatesoft.svn.core SVNURL]
   [org.tmatesoft.svn.core.wc SVNClientManager]))

(.. (SVNClientManager/newInstance)
    (getCommitClient)
    (doMkdir (new-array SVNURL
                [(SVNURL/parseURIEncoded "svn://meh/scratch/foo")])
             "foo"))

new-array is something I wrote myself, which is like to-array except that
one can specify the element type of the array instead of always getting Object[]
and like to-array except that the array contents can be specified:

bpsmithmannschott.svnkit> (type (new-array String ["Foo" "Bar"]))
[Ljava.lang.String;

(defn new-array [type elements]
  (let [n (count elements),
        a (make-array type n)
        store (case type
                    Boolean/TYPE #(aset-boolean a %1 %2)
                    Byte/TYPE #(aset-byte a %1 %2)
                    Char/TYPE #(aset-char a %1 %2)
                    Double/TYPE #(aset-double a %1 %2)
                    Float/TYPE #(aset-float a %1 %2)
                    Integer/TYPE #(aset-int a %1 %2)
                    Long/TYPE #(aset-long a %1 %2)
                    Short/TYPE #(aset-short a %1 %2)
                    #(aset a %1 %2))]
    (dorun (map-indexed store elements))
    a))

I've also tried type hinting the arguments to the doMkdir call, but the
results are the same as above:

(doMkdir ^"[Lorg.tmatesoft.svn.core.SVNURL;" (new-array SVNURL
                [(SVNURL/parseURIEncoded "svn://meh/scratch/foo")])
          "foo")

What am I doing wrong?

Do I have to write static casting functions a'la "ints", "floats" etc
*in* *Java* to get this to work?

Thanks,

// Ben

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
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