We're updating the issue view to help you get more done. 

Type tags on argument vector appear to help avoid reflection when used with defn, but not with def foo (fn ...)

Description

I would have expected that both of the Java interop calls below would avoid reflection, but only the first involving f1 does.

1 2 3 4 5 6 7 8 9 10 11 12 Clojure 1.6.0 user=> (set! *warn-on-reflection* true) true user=> (defn f1 ^java.util.LinkedList [coll] (java.util.LinkedList. coll)) #'user/f1 user=> (def f2 (fn ^java.util.LinkedList [coll] (java.util.LinkedList. coll))) #'user/f2 user=> (.size (f1 [2 3 4])) 3 user=> (.size (f2 [2 3 4])) Reflection warning, NO_SOURCE_PATH:5:1 - reference to field size can't be resolved. 3

Not sure if this has anything to do with CLJ-1232, but was discovered when testing variants of that issue.

Environment

None

Status

Assignee

Unassigned

Reporter

Andy Fingerhut

Labels

Approval

None

Patch

None

Affects versions

Release 1.6

Priority

Minor