Integrated: 8290973: In AffineTransform, equals(Object) is inconsistent with hashCode()
Martin Desruisseaux
duke at openjdk.org
Thu Oct 6 16:06:56 UTC 2022
On Fri, 10 Jun 2022 09:39:48 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.
This pull request has now been integrated.
Changeset: 5c030ccc
Author: Martin Desruisseaux <martin.desruisseaux at geomatys.com>
Committer: Jayathirth D V <jdv at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/5c030cccae6cd7862b7ecc563fde4b7670f25c10
Stats: 108 lines in 2 files changed: 100 ins; 0 del; 8 mod
8290973: In AffineTransform, equals(Object) is inconsistent with hashCode()
Reviewed-by: prr
-------------
PR: https://git.openjdk.org/jdk/pull/9121
More information about the client-libs-dev
mailing list