On Thu, May 24, 2012 at 6:16 AM, John Szakmeister <[email protected]> wrote: > On Wed, May 23, 2012 at 7:58 PM, Cedric Greevey <[email protected]> wrote: >> (defn f [^java.awt.image.BufferedImage bi x] >> (.setSample (.getRaster bi) 0 0 0 (double x))) >> #<CompilerException java.lang.IllegalArgumentException: More than one >> matching method found: setSample, compiling:(NO_SOURCE_PATH:1)> >> >> The only way I was able to find to fix this is >> >> (defn f [^java.awt.image.BufferedImage bi] >> (.setSample (.getRaster bi) 0 0 0 ^Double (double x))) > > I'm entirely not sure what's going on, but this seems to be good in the repl: > > (defn f [^java.awt.image.BufferedImage bi x] > (.setSample (.getRaster bi) (int 0) (int 0) (int 0) ^double x)) > > I tried creating an object and running it through the function as well > with no warnings.
I don't get it. The setSample methods aren't disambiguated by the types of the coordinate arguments -- there's just int int int int, int int int float, and int int int double overloads, so the exact right one should be inferrable if the final argument is known to be a double (and the WritableRaster itself is hinted). It being a primitive local double really ought to suffice, and certainly specifying that the middle arguments are ints shouldn't logically have any effect. Well, except to add a bit of overhead with three additional calls to RT.intCast that really ought to be avoidable. -- 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
