I'm trying to resolve a reflection warning in Clojure that seems to result from the lack of type inference on function return values that are normal Java objects.
Trivial example code that demonstrates the issue:
(set! *warn-on-reflection* true)
(defn foo [#^Integer x] (+ 3 x))
(.equals (foo 2) (foo 2))
=> Reflection warning, NO_SOURCE_PATH:10 - call to equals can't be resolved.
true
What is the best way to solve this? Can this be done with type hints?