[ https://issues.apache.org/jira/browse/TINKERPOP-3170?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrea C updated TINKERPOP-3170: -------------------------------- Description: 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. was: `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: ``` @Override public boolean equals(final Object other) { return other != null && other.getClass().equals(this.getClass()) && this.hashCode() == other.hashCode(); } ``` 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. > Majority of steps violate hashcode/equals contracts > --------------------------------------------------- > > Key: TINKERPOP-3170 > URL: https://issues.apache.org/jira/browse/TINKERPOP-3170 > Project: TinkerPop > Issue Type: Bug > Affects Versions: 3.7.3 > Reporter: Andrea C > 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)