RFR: 8290973: In AffineTransform, equals(Object) is inconsistent with hashCode() [v2]

Martin Desruisseaux duke at openjdk.org
Tue Sep 20 09:48:36 UTC 2022


On Mon, 22 Aug 2022 17:13:26 GMT, Martin Desruisseaux <duke at openjdk.org> wrote:

>> `AffineTransform.equals(Object)` and `hashCode()` break two contracts:
>> 
>> * `A.equals(A)` returns `false` if at least one affine transform coefficient is NaN.
>> * `A.equals(B)` should imply `A.hashCode() == B.hashCode()`, but it is not the case if a coefficient is zero with an opposite sign in A and B.
>> 
>> This patch preserves the current behaviour regarding 0 (i.e. -0 is considered equal to +0) for backward compatibility reason. Instead the `hashCode()` method is updated for being consistent with `equals(Object)` behaviour.
>
> Martin Desruisseaux has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix a trivial typo: "into to" -> "to".

A ping for preventing this merge request to be automatically closed. This MR has been approved in August 11 and is ready for integration by a committer (if no more comment).

-------------

PR: https://git.openjdk.org/jdk/pull/9121



More information about the client-libs-dev mailing list