calling hashCode on clojure.lang.LazyTransformer causes a StackOverflowError

Description

Calling .hashCode on a an instance of clojure.lang.LazyTransformer causes a StackOverflowError:

The trace is

Relevant lines:

Cause: Looks like "seq" returns "this":

https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LazyTransformer.java#L55

This does NOT occur on an empty sequence, as clojure.core/sequence short-circuits.

Proposal: compute and cache hash and hasheq using same algorithm used in other seqs

Patch: CLJ-1600-2.patch

Screened by: Alex Miller

Environment

OS X 10.10.1, Macbook Pro,, Java 1.8.0_11, Clojure 1.7.0-alpha4

Activity

Show:
Ghadi Shayban
November 25, 2014, 7:24 PM

Test case added. Verified case was failing with SO prior to patch.

Alex Miller
November 25, 2014, 4:13 PM

What's here looks good. Can we hook into existing tests that verify equals/hashcode and equiv/hasheq equivalence?

Ghadi Shayban
November 25, 2014, 7:18 AM

Patch with hashcode calculation and caching similar to ASeq. Might be worthwhile hoisting that into its own hashSeq method.

Completed
Your pinned fields
Click on the next to a field label to start pinning.

Assignee

Unassigned

Reporter

import

Labels

Approval

Ok

Patch

Code and Test

Priority

Major

Affects versions

Fix versions