<i18n dev> RFR: 8369184: SimpleTimeZone equals() Returns True for Unequal Instances with Different hashCode Values [v3]
Naoto Sato
naoto at openjdk.org
Wed Oct 8 18:15:42 UTC 2025
On Wed, 8 Oct 2025 17:44:43 GMT, Pavel Rappo <prappo at openjdk.org> wrote:
>> Naoto Sato has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Address review comments
>
> test/jdk/java/util/TimeZone/SimpleTimeZoneEqualsHashCodeTest.java line 59:
>
>> 57: assertNotEquals(STZ_WITH_DST, stz);
>> 58: // from the contract point, hash codes may be the same
>> 59: assertNotEquals(STZ_WITH_DST.hashCode(), stz.hashCode());
>
> Like you said, from `!a.equals(b)` it does not follow that `a.hashCode() != b.hashCode()`. Unless you want hash code to specifically have this additional property, I'd remove this assertion.
I wanted to test the implementation which takes DST related fields into consideration for hash code calculation. Added some comments for clarity
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27660#discussion_r2414647340
More information about the i18n-dev
mailing list