I'm working on some Java / Clojure interoperability and came across a reflection warning for the following code:
(defn load-image [resource-name]
(javax.imageio.ImageIO/read
(.getResource
(class javax.imageio.ImageIO)
resource-name)))
=> Reflection warning, clojure/repl.clj:37 - reference to field read can't be resolved.
I'm surprised at this because getResource always returns a URL and I would therefore expect the compiler to use the appropriate static method in javax.imageio.ImageIO/read.
The code works fine BTW so it is clearly finding the right method at run time.
So two questions:
- Why is this returning a reflection warning?
- What type hint do I need to fix this?