<i18n dev> RFR: 8311188: Simplify and modernize equals and hashCode in java.text
Chen Liang
liach at openjdk.org
Tue Jul 4 00:42:58 UTC 2023
On Tue, 4 Jul 2023 00:22:02 GMT, Pavel Rappo <prappo at openjdk.org> wrote:
>> src/java.base/share/classes/java/text/AttributedString.java line 661:
>>
>>> 659:
>>> 660: // returns whether the two objects are either both null or equal
>>> 661: private static boolean valuesMatch(Object value1, Object value2) {
>>
>> Can this be simply inlined, that its occurrences are replaced by Objects.equals?
>
> It certainly can, but...
>
> I've been working on a similar PR for the java.util package. That package has lots of performance-sensitive locations that could also use `Objects.equals`. In that package, I ran into comments referring to an issue with using Object.equals: [JDK-8015417](https://bugs.openjdk.org/browse/JDK-8015417). So, I might do some additional research before integrating this PR.
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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14752#discussion_r1251361532
More information about the i18n-dev
mailing list