I'm having a play with the Java NIO.2 API from JDK 7.
In particular, I want to call the method: Paths#get(String first, String... more)
This is a static method which takes in at least one string, and returns a Path object corresponding to it. There's an overloaded form: Paths#get(URI uri)
However, I can't seem to call the top method from Clojure. The nearest I can seem to get is this:
(Paths/get ^String dir-fq (object-array 0))
which fails with:
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;
as you might expect. After all, we're passing in an Object[] to something that's expecting String[].
I've tried removing the (object-array) form - but that just causes Clojure to try to call the get(URI) method - both with and without the type hint.
Passing nil as the second argument to Paths#get(String, String...) causes the right method to be called, but Java 7 then fails with an NPE.
I can't seem to find a way in Clojure to express the type String[] - I'm guessing I either need to do that or provide a hint to the dispatch system.
Any ideas?