RFR: JDK-8199216: Memory leak and quadratic layout time with nested nodes (hbox) and pseudo-class in style sheet [v3]

John Hendrikx jhendrikx at openjdk.org
Tue Apr 25 05:43:23 UTC 2023


On Mon, 24 Apr 2023 21:05:57 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> John Hendrikx has updated the pull request incrementally with three additional commits since the last revision:
>> 
>>  - Base BitSet on AbstractSet to inherit correct equals/hashCode/toArray
>>    
>>    - Removed faulty toArray implementations in PseudoClassState and
>>    StyleClassSet
>>    - Added test that verifies equals/hashCode for PseudoClassState respect
>>    Set contract now
>>    - Made getBits package private so it can't be inherited
>>  - Remove unused code
>>  - Ensure Match doesn't allow modification
>
> modules/javafx.graphics/src/main/java/com/sun/javafx/css/BitSet.java line 546:
> 
>> 544:         }
>> 545:         if (obj instanceof BitSet<?> bitSet) {  // fast path if other is a BitSet
>> 546:             return equalsBitSet(bitSet);
> 
> I suspect this will not work
> BitSet<Integer> will never be equal to BitSet<String>, does it mean we have to do a per-element comparison?

> I suspect this will not work BitSet will never be equal to BitSet, does it mean we have to do a per-element comparison?

If I understand correctly, you're pointing out that if you have two bit sets, of different element types (currently in use we have `BitSet<PseudoClassState>` and `BitSet<StyleClass>`) but they have the same bit pattern and size, that they could be considered equals.

This is a good point, and a problem that has been part of `BitSet` since its inception.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1076#discussion_r1176027245


More information about the openjfx-dev mailing list