I often find myself addressing reflection warnings by placing annotations which type is completely obvious:
(def ^String foo "bar") ;; adding ^String fixes reflection warnings elsewhere
"bar" is a String, that is unmistakably known at compile-time, so it seems to me that I'm doing grunt work, and also creating something that might become outdated later.
Has it been considered to add "type inference" for such straightforward cases?
("type inference" is probably an exaggerated term for this use case)
...I can imagine at least one objection:
(def ^CharSequence foo "bar") can also be accurate and useful. But a good default would be to infer the type of x to be the x's class - if a user wanted to annotate x as one of its ancestors (here: CharSequence, Object), he could override the inferred default by hand.