On Mon, 28 Aug 2023 21:24:18 GMT, Justin Lu <j...@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`). src/java.base/share/classes/java/text/ChoiceFormat.java line 501: > 499: * > 500: * The hash code value is based on the values returned by {@link > #getLimits()} and > 501: * {@link #getFormats()}. Could this part (and its counterpart in `equals()`) be more generalized? In this method, it spells out the fields to be considered, and in other classes, it simply mentions "same format configuration." Maybe using links to `Serialized Form` and making the sentence more generic? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15459#discussion_r1309312616