RFR: 8311188: Simplify and modernize equals and hashCode in java.text [v3]

Pavel Rappo prappo at openjdk.org
Wed Jul 5 20:09:55 UTC 2023


On Wed, 5 Jul 2023 17:39:49 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Do you mean we could use `obj instanceof DecimalFormat other` in front of that 30-line `&&` expression, or that we could collapse the list to exactly what you wrote?
>> 
>> Separately, `super.equals` already performs the class check; so enhanced `instanceof` could be used only as a syntactic sugar, but even then it won't decrease the line count: we trade one line for another very similar line.
>
> Just what I wrote; I agree its a toss up from lines of code and performance.
> I spotted that style in other files and its just a question of style; your choice.

I see. We are likely on the same page. My guess is that you saw incomplete source in "Files changed" on GitHub. In reality, that return statement spans 30 lines. I was initially confused by that trailing semicolon in your suggestion; I thought you propose to remove everything but those three lines, hence my question.

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

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


More information about the core-libs-dev mailing list