RFR: 7083187: Class CSS.CssValue is missing implementations of equals() and hashCode()

Prasanta Sadhukhan psadhukhan at openjdk.org
Tue May 2 11:13:22 UTC 2023


On Mon, 10 Apr 2023 12:44:08 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

> The change looks good but it doesn't address the whole problem raised in the [JDK-7083187](https://bugs.openjdk.org/browse/JDK-7083187): `CSS.CssValue` does not implement `equals`. This fix addresses only one particular case: `CSS.FontSize` for `font-size` property.
> 
> I do not think it resolves the problem _entirely_: `CssValue` and all its subclasses must implement `equals` method, otherwise adding another CSS attribute to `AttributeSet` will lead to this same issue described in the bug report.

Yes, since CSS Attributes are quite extensive, I have only addressed part of it in this PR mainly CSS.Font properties..
Additional PR can be raised for other attributes in due course..

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

PR Comment: https://git.openjdk.org/jdk/pull/13405#issuecomment-1531285902



More information about the client-libs-dev mailing list