<i18n dev> RFR: 5066247: Refine the spec of equals() and hashCode() for j.text.Format classes [v2]
Naoto Sato
naoto at openjdk.org
Fri Sep 1 22:16:39 UTC 2023
On Fri, 1 Sep 2023 19:56:53 GMT, Justin Lu <jlu at openjdk.org> wrote:
>> Please review this PR which refines the spec of `equals()` and `hashCode()` in `java.text.Format` related classes.
>>
>> The current spec for most of these methods is either "_Overrides <method_name>_" or are incomplete/wrong (i.e. see `ChoiceFormat`).
>>
>> This fix adjusts the spec to provide a consistent definition for the overridden methods and specify what is being compared/used to generate a hash code value.
>>
>> For implementations that use at most a few fields, the values are stated, otherwise a more general term is used as a substitution (i.e. see `DecimalFormat`).
>
> Justin Lu has updated the pull request incrementally with one additional commit since the last revision:
>
> Reflect review comments: Make implementers aware of default classIdentity notion, generalize all hashcodes/equals, adjust hashCode spec to be more accurate
src/java.base/share/classes/java/text/ChoiceFormat.java line 521:
> 519: *
> 520: * @implNote Implementers should be aware that the default implementation does an
> 521: * equality check using {@code getClass} rather than {@code instanceOf} when
Since `instanceof` is a Java keyword, I'd expect it not to be camel-cased.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15459#discussion_r1313583508
More information about the i18n-dev
mailing list