Affects Version/s: Release 1.3, Release 1.4, Release 1.5
Environment:Clojure 1.3 om Mac OS 10.7, Clojure 1.5.0 alpha1 on Linux x86_64 (OpenJDK 1.7.0 b147)
Patch:Code and Test
I (Stu) agree with Nicola's assessment in the comments: the single real problem here is that the compiler's MapExpr parser emits maps differently from other map-makers, e.g. RT's factory functions.
Patch clj944-plus-tests does three things:
- has the compiler emit map types consistent with the reader (like the previous "0002" patch)
- adds tests
- removes broken tests
Original report follows:
Hi guys, I am getting the following exception:
The map is a clojure.lang.PersistentArrayMap, which obviously has a containsKey method (https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentArrayMap.java#L95).
Casting it works fine though:
The mailing list suggest that the compiler injects an incorrect cast to clojure.lang.PersistentHashMap. In this case it should probably be cast to a clojure.lang.Associative, the highest common interface having the .containsKey method.
The problem is not present in Clojure 1.2.1.