Uploaded image for project: 'Clojure'
  1. CLJ-1372

Inconsistent hash with java collections

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects versions: Release 1.6
    • Fix versions: Backlog
    • Environment:

      1.6.0 master

    • Approval:
      Vetted
    • Patch:
      Code and Test

      Description

      c.c/hash always use hashCode for java collections, which is incompatible when comparing with Clojure collections, which use Murmur3.

      user=> (== (hash (java.util.ArrayList. [1 2 3])) (hash [1 2 3]))
      false
      user=> (= (java.util.ArrayList. [1 2 3]) [1 2 3])
      true
      

      One way to fix it is to add a special case in Util/hasheq for java.util.Collections, as it is now for Strings.

      Link to a discussion of this topic in the Clojure group: https://groups.google.com/forum/#!topic/clojure/dQhdwZsyIEw

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              wagjo Jozef Wagner
            • Votes:
              9 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated: