Skip to content

HashTree can theoretically drop elements #2831

Closed
@asfimport

Description

@asfimport

Sebb (Bug 53277):
The HashTree class currently uses a HashMap to store test elements.

Now a HashMap cannot store two Objects which compare equal and have the same hash code. Test elements currently use the system hash code, so collisions are unlikely; however they are not impossible. It's quite easy to create multiple test elements which compare equal.

So there is a risk that a new element which is added to the HashTree could displace an existing entry.

One solution to this is to use IdentityHashMap instead of HashMap; this uses == rather than equals when comparing elements.

OS: All

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions