Welcome! Please see the About page for a little more info on how this works.

0 votes
in Compiler by

If I create (link: https://github.com/MichaelBlume/resolve-fail/blob/master/src/java/resolve_fail/Thing.java text: a class) with two methods, one of which takes (String, String), and the other taking (String, Number), and then write a function

(defn foo [x ^String y] (Thing/hello x y))

it seems obvious that I'm trying to call the first method and not the second. But on lein check, clojure prints

Reflection warning, resolve_fail/core.clj:6:3 - call to static method hello on resolve_fail.Thing can't be resolved (argument types: unknown, java.lang.String).

unless I also type-hint x.

2 Answers

0 votes
by

Comment made by: bronsa

I have looked at this countless times while working on tools.analyzer and hacking the reflector and found out that there doesn't seem to be a way to make things like this "work" without breaking other cases

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-1687 (reported by michaelblume)
...