RFR: JDK-8199216: Memory leak and quadratic layout time with nested nodes (hbox) and pseudo-class in style sheet [v2]
John Hendrikx
jhendrikx at openjdk.org
Fri Mar 31 22:18:30 UTC 2023
On Fri, 31 Mar 2023 18:07:02 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/com/sun/javafx/css/BitSet.java line 588:
>>
>>> 586: protected abstract T cast(Object obj);
>>> 587:
>>> 588: protected long[] getBits() {
>>
>> Since your patch already contains some cleanup work: can you make this method `final`? The way it's specified at the moment looks like it was made to be overridable, which is clearly not useful.
>
> Sure, I don't mind, the class is not public though, nor are its subclasses.
I've made this method package private instead of protected. The only reason it was protected was so that `toArray` implementations in the two subclasses could access it. However, those implementations are totally unnecessary as `AbstractCollection` provides them, without bugs and likely with perfectly acceptable performance.
By basing `BitSet` on `AbstractSet`, which it probably should have been from the beginning, I also inherit contract respecting equals/hashCode implementations -- the only concession I did here is to provide a fast(er?) path when both sets are `BitSet`s.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1076#discussion_r1154949274
More information about the openjfx-dev
mailing list