<i18n dev> RFR: 8311188: Simplify and modernize equals and hashCode in java.text

Pavel Rappo prappo at openjdk.org
Tue Jul 4 01:04:07 UTC 2023


On Tue, 4 Jul 2023 00:40:14 GMT, Chen Liang <liach at openjdk.org> wrote:

> Hmm, I think that issue refers to code that have explicit non-Object parameter types (like `X::equals(Object)boolean` in the issue's sample). This method already have both arguments as `Object`, so I don't think there's any type-specific inlining opportunities.

If that's true, then perhaps those (and some other) locations got that idea wrong:
* https://github.com/openjdk/jdk/blob/faf1b822d03b726413d77a2b247dfbbf4db7d57e/src/java.base/share/classes/java/util/Collections.java#L5712-L5719
* https://github.com/openjdk/jdk/blob/faf1b822d03b726413d77a2b247dfbbf4db7d57e/src/java.base/share/classes/java/util/AbstractMap.java#L577-L585

Maybe @rose00 could clarify that? 

FWIW, I also note that `HashMap` does not use similar private static methods; it uses `Objects.equals(Object, Object)` and `Objects.hashCode` overloads that take parameters.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14752#discussion_r1251369954


More information about the i18n-dev mailing list