Clojure JIRAhttp://dev.clojure.org/jira
This file is an XML representation of an issueen-us4.464925-07-2011[CLJ-1335] PersistentList$EmptyList and empty LazySeq still returns old value for hasheqhttp://dev.clojure.org/jira/browse/CLJ-1335
Clojure<p>After late Jan 2014 changes to hash functions, PersistentList$EmptyList and (lazy-seq) were left behind:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">user=&gt; (= '() (lazy-seq) [])
<span class="code-keyword">true</span>
user=&gt; (map hash ['() (lazy-seq) []])
(1 1 -2017569654)
user=&gt; (map class ['() (lazy-seq) []])
(clojure.lang.PersistentList$EmptyList clojure.lang.LazySeq clojure.lang.PersistentVector)</pre>
</div></div>
<p>PersistentQueue/EMPTY was updated, so should not need any change.</p>
<p><b>Solution:</b> Update LazySeq.hasheq() and make EmptyList implement IHashEq. EmptyList now creates a static constant for the hash value of an empty ordered collection and returns the constant for hasheq. An alternative would be to have Murmur3 have this constant instead.</p>
<p><b>Patch:</b> clj-1335-v2.patch<br/>
<b>Depends on:</b> <a href="http://dev.clojure.org/jira/browse/CLJ-1338" title="New Murmur3 class is not public"><del>CLJ-1338</del></a>, <a href="http://dev.clojure.org/jira/browse/CLJ-1339" title="Empty primitive vectors throw NPE on .equals with non-vector sequential types"><del>CLJ-1339</del></a>, <a href="http://dev.clojure.org/jira/browse/CLJ-1331" title="Primitive vectors should use new hash"><del>CLJ-1331</del></a> (must be applied first)</p>
<p><b>Patch:</b> </p>CLJ-1335PersistentList$EmptyList and empty LazySeq still returns old value for hasheqDefectBlockerClosedCompletedUnassignedAndy FingerhutThu, 30 Jan 2014 13:44:15 -0600Fri, 14 Feb 2014 10:18:53 -0600Fri, 14 Feb 2014 10:18:53 -0600Release 1.6Release 1.601<p>Patch clj-1335-v1.diff adds tests that assume the patch clj-1331-v1.diff on ticket <a href="http://dev.clojure.org/jira/browse/CLJ-1331" title="Primitive vectors should use new hash"><del>CLJ-1331</del></a> have already been committed. If it is desired to combine these into one patch, or commit this one without that one, I can eliminate that dependency.</p>
<p>Makes PersistentList$EmptyList implement IHashEq interface with a straightforward implementation of hasheq(), comments out empty LazySeq special case check that caused it to return old hash value, and fixes a NullPointerException for primitive vectors discovered by the new tests added.</p>ApprovalOkGlobal RankPatchCode and Test