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
Mon Apr 3 07:21:36 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.

The name might need updating, although when the name can't cover the exact intended functionality, the docs are supposed to explain all the details.

I may not need the cast at all anymore; I think the class is just asking for casts to satisfy some generic code, but that shouldn't be relevant.  All I would really need is an instanceof check.  I'll have another look.

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

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


More information about the openjfx-dev mailing list