RFR: 8262927: Explicitly state fields examined for BigDecimal.hashCode

Joe Darcy darcy at openjdk.java.net
Wed Mar 3 22:24:55 UTC 2021


The class BigDecimal can be and sometimes is subclassed. The spec of BigDecimal.hashCode is improved slightly by explicitly stating it is a function of the unscaled value and the scale of the BigDecimal, the same fields examined by equals.

It is a conscious choice to *not* explicitly state what the exact hash function is.

As the behavior of hashCode is mostly implied from equals, I don't think a CSR is necessary in this case.

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

Commit messages:
 - 8262927: Explicitly state fields examined for BigDecimal.hashCode

Changes: https://git.openjdk.java.net/jdk/pull/2817/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2817&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8262927
  Stats: 7 lines in 1 file changed: 5 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2817.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2817/head:pull/2817

PR: https://git.openjdk.java.net/jdk/pull/2817


More information about the core-libs-dev mailing list