Skip to content

DD.equals(DD) does not override Object.equals(Object) — also violates clone and compareTo contracts #1185

@shanjiang98

Description

@shanjiang98

Labels: bug

Body:

Summary

DD defines equals(DD y) (line 988) with parameter type DD instead of Object. This is
a method overload, not an override of Object.equals(Object). Standard Java APIs
(HashMap, HashSet, List.contains(), etc.) call equals(Object), which falls through
to Object.equals() (identity comparison).

Additionally, DD implements Comparable with a value-based compareTo() and Cloneable
with clone(), but since Object.equals() is not properly overridden, both the
compareTo-equals consistency and clone-equals contracts are violated.

How this was found

Detected by automated JDK conformance oracles (checkCompareToEqualsConsistency,
checkCloneEqualsConsistency).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions