On Mon, 8 Dec 2025 06:51:44 GMT, John Hendrikx <[email protected]> wrote:

> I think this is unsafe, depending on where the `null`s are sorted in the list 
> (especially with a `nullsFirst` comparator). It may be better to get the 
> `size` at the start of this method, and then clear anything from `size` to 
> `oldSize` unconditionally.

I tried to create the issue as you outlined, but this code does not get called 
when there's a comparator set (`updateUnsorted()`). 

Every element (null or not) gets wrapped in an `Element` class (so there are no 
nulls), this just nulls these Element objects when they're out of range (again, 
only for the unsorted). And they should stay like that (unless source list 
increases again).

I could re-write (using oldSize) as you suggested but it might suggest 
something about the behaviour that cannot happen...? (I could be missing 
something fundamental -- correct me if so).

I updated the tests there, hopefully proving this.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2000#discussion_r2600014350

Reply via email to