<< Back to previous view

[CLJ-875] Clojure's seq, keys, and vals can produce inconsistent values on strange iterators (e.g., IdentityHashMap) Created: 11/Nov/11  Updated: 02/Dec/11  Resolved: 02/Dec/11

Status: Closed
Project: Clojure
Component/s: None
Affects Version/s: Release 1.3, Release 1.4
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Jason Wolfe Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: None


user> clojure-version
{:major 1, :minor 4, :incremental 0, :qualifier "alpha1"}
user> (def x (keys (java.util.IdentityHashMap. {:a true :b true})))
user> x
(:b :a)
user> x
(:a :a)

As discussed on the mailing list, it's not clear exactly whose fault this is:
given that the javadocs for iterators and entrySet dont' seem to require (or mention at all) whether each .next() must return a unique value.

keys and vals could be fixed by using keySet and values rather than entrySet, at least in this case, but this would not help for seq.

Comment by Stuart Halloway [ 02/Dec/11 9:28 AM ]

The powers that be acknowledge that this is Java's fault: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6312706

Generated at Tue Jan 16 19:15:00 CST 2018 using JIRA 4.4#649-r158309.