Clojure 1.12.7, JDK 21.
After a persistent dissoc from a HashCollisionNode, a key that is still in the map can become unreachable with get:
(def a (java.util.ArrayList. [0 42]))
(def b (java.util.ArrayList. [1 11]))
[(hash a) (hash b) (hash [0 42]) (= a [0 42])]
;; => [1003 1003 1867155179 true]
(def m3 (-> (hash-map a :A b :B)
(dissoc [0 42])
(assoc a :A2)))
[m3 (count m3) (get m3 b)]
;; => [{[1 11] :B, [0 42] :A2} 2 nil]
m3 prints b as a key and count is 2, but (get m3 b) returns nil. Hash sets have the same problem:
(-> (hash-set a b) (disj [0 42]) (conj a) (contains? b))
;; => false
The transient path (dissoc! then assoc!) returns :B as expected.
a and b are two ArrayLists with the same hash, so they share a HashCollisionNode. The vector [0 42] is = to a but has a different hash (the known mismatch in CLJ-1372). HashCollisionNode.without builds the new node with the hash parameter, which is the hash of the key passed to dissoc, instead of the node's own this.hash:
return new HashCollisionNode(null, hash, count - 1, removePair(array, idx/2));
So the remaining node records 1867155179 instead of 1003. The next assoc of a (hash 1003) sees a different hash and splits the two into separate branches, and a lookup of b follows the branch for 1003, where only a is.
Using this.hash in that constructor call makes (get m3 b) return :B and contains? return true in the examples above. I checked this by compiling the changed class and putting it ahead of the 1.12.7 jar on the classpath.
This bug is reported at https://s.conao3.com/blog/2026/8bda7e