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
Tue Apr 25 07:09:20 UTC 2023


On Sun, 2 Apr 2023 23:49:55 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> I'm a bit unsure why that would be an improvement. Passing `null` to a function that doesn't expect it should IMHO never just return `null` but should instead be considered a programming error and result in a stack trace.  Passing in a non-null value that can't be casted is explicitly documented now that it would result in `null`.  One is a caller error, the other isn't IMHO (as the caller can't check if it is castable without another method -- I considered adding an `instanceof` method).
>> 
>> Or maybe I'm reading too much in to this and you are just pointing out that the function has changed from its previous contract -- I think this is okay as `BitSet` is not public API, nor are any of its subclasses.
>
> I found it strange that a method named `cast` would reject `null` as an argument, but will happily return `null` and require the caller to check it.

@mstr2 I've changed this cast method now to a `getElementType` method to be able to provide a correct `equals` implementation under all circumstances.

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

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


More information about the openjfx-dev mailing list