You could type hint the target (which is what the warning is about, not the argument types):
user=> (type *err*)
java.io.PrintWriter
user=> (.println ^java.io.PrintWriter *err* "foo")
foo
nil
I suspect this is because *err*
is a dynamically bound var so the compiler doesn't know its type, even tho' the bound value is java.io.PrintWriter
.
You could also use the new-in-1.12 qualified method access, to avoid the warning:
user=> (set! *warn-on-reflection* true)
true
user=> (.println *err* "foo")
Reflection warning, NO_SOURCE_PATH:1:1 - call to method println can't be resolved (target class is unknown).
foo
nil
user=> (import 'java.io.PrintWriter)
java.io.PrintWriter
user=> (PrintWriter/.println *err* "foo")
foo
nil