On Wed, 5 Jul 2023 15:47:56 GMT, Roger Riggs <[email protected]> wrote:
>> Pavel Rappo has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Adhere to surrounding code style
>
> src/java.base/share/classes/java/text/DecimalFormat.java line 2926:
>
>> 2924: if (obj == this) { // disambiguate super equality from ref
>> equality
>> 2925: return true;
>> 2926: }
>
> Ditto comment in CompactNumberFormat.
Fixed this and the other one in b338480e540.
> src/java.base/share/classes/java/text/DecimalFormat.java line 2930:
>
>> 2928: DecimalFormat other = (DecimalFormat) obj;
>> 2929: return ((posPrefixPattern == other.posPrefixPattern &&
>> 2930: positivePrefix.equals(other.positivePrefix))
>
> This might also be:
>
> return (obj instanceof DecimalFormat other) &&
> posPrefixPattern == other.posPrefixPattern &&
> positivePrefix.equals(other.positivePrefix));
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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14752#discussion_r1253358517
PR Review Comment: https://git.openjdk.org/jdk/pull/14752#discussion_r1253357171