You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Thiago Henrique De Paula Figueiredo (Jira)" <ji...@apache.org> on 2021/02/11 21:38:00 UTC
[jira] [Closed] (TAP5-2658) Tuple should implement hashCode based
on its values
[ https://issues.apache.org/jira/browse/TAP5-2658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thiago Henrique De Paula Figueiredo closed TAP5-2658.
-----------------------------------------------------
Resolution: Fixed
> Tuple should implement hashCode based on its values
> ---------------------------------------------------
>
> Key: TAP5-2658
> URL: https://issues.apache.org/jira/browse/TAP5-2658
> Project: Tapestry 5
> Issue Type: Bug
> Components: tapestry-func
> Reporter: Benjamin Weidig
> Assignee: Benjamin Weidig
> Priority: Minor
> Fix For: 5.6.2, 5.7.0
>
>
> h2. 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.
> h2. 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".
> h2. Alternatives
> Deprecating Tuple, and providing a new implementation.
> h2. 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.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)