RFR: 8311170: Simplify and modernize equals and hashCode in security area [v12]

Pavel Rappo prappo at openjdk.org
Fri Aug 4 20:55:40 UTC 2023


On Fri, 4 Aug 2023 19:54:58 GMT, Sean Mullan <mullan at openjdk.org> wrote:

> I would add to that list that I think it is really important any change to the `hashCode` impl doesn't break the equals/hashCode contract, so it's important to look at the `equals` implementation in conjunction with any changes to `hashCode`, mostly to ensure 2 equal objects continue to have the same hash code.

True. I skipped that criteria, as I thought it should go without saying.

> It is also important to question any oddity about the `hashCode` impl, like I did for DESKey and try to understand why it may have been implemented that way, such as skipping the first byte.

True again. If you have any other examples where the changes to hashCode look suspicious, please tell me so.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14738#discussion_r1284837771


More information about the security-dev mailing list