On Tue, 2 May 2023 11:13:00 GMT, Prasanta Sadhukhan <psadhuk...@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 three > additional commits since the last revision: > > - Test fix > - Test fix > - Review comment address src/java.desktop/share/classes/javax/swing/text/html/CSS.java line 2323: > 2321: @Override > 2322: public boolean equals(Object val) { > 2323: return val instanceof CSS.FontFamily font && family == > font.family; Is the `family` field interned somewhere? If it isn't, then should this be: return val instanceof CSS.FontFamily font && Objects.equals(family, font.family); For ex if we tweak the start of the FontFamily unit test as follows does it still pass? private static void testFontFamily() { StyleSheet ss = new StyleSheet(); SimpleAttributeSet a = new SimpleAttributeSet(); ss.addCSSAttribute( a, CSS.Attribute.FONT_FAMILY, "Sans-Serif"); SimpleAttributeSet b = new SimpleAttributeSet(); ss.addCSSAttribute( b, CSS.Attribute.FONT_FAMILY, "Sans-Serif"); ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13405#discussion_r1182870307