RFR: 7083187: Class CSS.CssValue is missing implementations of equals() and hashCode() [v4]
Alexey Ivanov
aivanov at openjdk.org
Fri May 5 18:05:23 UTC 2023
On Wed, 3 May 2023 11:00:36 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:
>
> More Attrbutes added
Changes requested by aivanov (Reviewer).
src/java.desktop/share/classes/javax/swing/text/html/CSS.java line 2539:
> 2537: return val instanceof CSS.BorderStyle border && style.equals(border.style);
> 2538: }
> 2539: // CSS.Values are static, don't archive it.
Suggestion:
}
// CSS.Values are static, don't archive it.
A blank line between a method body and a field.
src/java.desktop/share/classes/javax/swing/text/html/CSS.java line 2675:
> 2673: return val instanceof CSS.LengthValue lu && span == lu.span;
> 2674: }
> 2675: /** If true, span is a percentage value, and that to determine
Suggestion:
}
/** If true, span is a percentage value, and that to determine
A blank line between a method body and a field.
src/java.desktop/share/classes/javax/swing/text/html/CSS.java line 2897:
> 2895: @Override
> 2896: public int hashCode() {
> 2897: return Float.hashCode(horizontalPosition);
For better hashing, `verticalPosition` should also be taken into account.
-------------
PR Review: https://git.openjdk.org/jdk/pull/13405#pullrequestreview-1415214777
PR Review Comment: https://git.openjdk.org/jdk/pull/13405#discussion_r1186364746
PR Review Comment: https://git.openjdk.org/jdk/pull/13405#discussion_r1186365254
PR Review Comment: https://git.openjdk.org/jdk/pull/13405#discussion_r1186366897
More information about the client-libs-dev
mailing list