Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
Summary
The class `org.apache.tapestry5.func.Tuple<A, B>` overrides `boolean equals(Object)` to check equality of its values.
But it doesn't provide an appropriate `int hashCode()` implementation, thereby violating a base contract of Java objects, leading to undefined behavior depending on someone using the hash code value.
Risks and Assumptions
Minimal risk is assumed.
Usage in HashMaps, or other hash code related structures/methods might behave differently.
But due to the previously broken contract, it should affect code using it "wrong".
Alternatives
Deprecating Tuple, and providing a new implementation.
Details of Proposed Changes
Add `hashCode()` based on `java.util.Objects.hash(Object...)`.
Add tests for `hashCode()`.
Code is already implemented and ready to be committed and pushed, if change is accepted.