RFR: 7083187: Class CSS.CssValue is missing implementations of equals() and hashCode() [v7]
Alexey Ivanov
aivanov at openjdk.org
Fri May 19 18:05:56 UTC 2023
On Tue, 9 May 2023 06:44:20 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> Two CSS AttributeSet-s can be compared using the AttributeSet.isEqual() method which can fail due to missing implementation of equals method in CSS subclasses.
>> In this issue, even when two CSS AttributeSet has same 42 font size string value, Object equality fails.
>> Fixed by implementing the equality and hashCode method for CSS.FontSize class.
>>
>> All jtreg/jck tests are ok
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>
> hashCode fix
May I suggest a simplified version of [the CSSAttributeEqualityBug.java test](https://github.com/aivanov-jdk/jdk/blob/4997c4dcc258a451e4177d267301abaadae122af/test/jdk/javax/swing/text/html/CSS/CSSAttributeEqualityBug.java) which contains a list of CSS declarations which produce equal attribute sets and another list of declarations which produce non-equal attribute sets.
The updated test covers all the existing cases as well as a few more cases for which I raised my concerns above.
To add a new test case, just add a new entry into either `EQUALS` or `NOT_EQUALS` array.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13405#issuecomment-1555041654
More information about the client-libs-dev
mailing list