Aaron, hello.

On 2012 Jan 11, at 03:05, Aaron Cohen wrote:

>> Using the stackoverflow problem as an example, it seems that I can't do
>> 
>>  (.queryForObject jdbcTemplate rowMapper)
> 
> I think your only problem here is that you're short an argument. If
> you want to call a function with varargs, you must provide an array
> that contains them. If you don't want any arguments, you still have to
> pass the empty array.
> 
> ie: (.queryForObject jdbcTemplate rowMapper (make-array Object 0))

Ach: I should have guessed that -- thanks.  That's pretty obvious, really, 
given the relevant section of the JLS.

A couple of extra observations:

  * The reference documentation at <http://clojure.org/java_interop> doesn't 
mention varargs at all, though I'd have thought this would be a natural place 
for it.

  * The error message "java.lang.IllegalArgumentException: No matching method 
found: <method-name> for class <class-name>" is perhaps a little too terse.  It 
would be very helpful if it could include the types of the objects being passed 
to it, which aren't matching -- thus something along the lines of "No matching 
method found: <method-name> for class <class-name> with arguments (<class> 
...)".  That wouldn't have led me to the answer in this case, but it would have 
helped me rule out some other causes more quickly, without 'prn's all over the 
place.

Thanks for your help; all the best,

Norman
[whose copy of "The Joy of Clojure" has reportedly been dispatched...]


-- 
Norman Gray  :  http://nxg.me.uk

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to