You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Stephen Mallette (Jira)" <ji...@apache.org> on 2025/10/10 12:40:00 UTC

[jira] [Updated] (TINKERPOP-3170) Majority of steps violate hashcode/equals contracts

     [ https://issues.apache.org/jira/browse/TINKERPOP-3170?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephen Mallette updated TINKERPOP-3170:
----------------------------------------
    Component/s: process

> Majority of steps violate hashcode/equals contracts
> ---------------------------------------------------
>
>                 Key: TINKERPOP-3170
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-3170
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: process
>    Affects Versions: 3.7.3
>            Reporter: Andrea Child
>            Priority: Major
>
> AbstractStep.java is the parent class for all steps which has the following `equals` method implementation which relies on the hashCode value to determine equality:
> {code:java}
> @Override
> public boolean equals(final Object other) {
>     return other != null && other.getClass().equals(this.getClass()) && this.hashCode() == other.hashCode();
> } {code}
> This is a violation of the hashCode and equals contracts because unequal objects may have the same hashCode. This reliance on hashCode comparison for equality can lead to unexpected behaviour and bugs which are difficult to troubleshoot. Almost all steps use this logic as I can only see 2 which override the equals method from the abstract parent.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)