On Thu, 8 Jun 2023 11:05:35 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:

>> Prasanta Sadhukhan has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Fix percentage equality as per span parsed value
>
> src/java.desktop/share/classes/javax/swing/text/html/CSS.java line 2690:
> 
>> 2688:             return val instanceof CSS.LengthValue lu
>> 2689:                    && span == lu.span
>> 2690:                    && Objects.equals(units, lu.units);
> 
> [The `percentage` 
> field](https://github.com/openjdk/jdk/pull/13405#discussion_r1221932524) must 
> also be part of `equals`:
> Suggestion:
> 
>             return val instanceof CSS.LengthValue lu
>                    && percentage == lu.percentage
>                    && span == lu.span
>                    && Objects.equals(units, lu.units);
> 
> You have included it in `hashCode`.

If `percentage` isn't taken into account, the pair `{"margin-top: 100%", 
"margin-top: 1"}` is considered equal.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13405#discussion_r1222907544

Reply via email to