`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.

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

Commit messages:
 - AffineTransform.equals(Object) is sometime inconsistent with itself and with 
hashCode().

Changes: https://git.openjdk.org/jdk/pull/9121/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=9121&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8290973
  Stats: 108 lines in 2 files changed: 100 ins; 0 del; 8 mod
  Patch: https://git.openjdk.org/jdk/pull/9121.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/9121/head:pull/9121

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

Reply via email to