On Mon, 19 Dec 2022 18:00:30 GMT, Kevin Rushforth <k...@openjdk.org> wrote:

> I spot-checked it and it seems OK, but I'll let Nir and Ambarish review it in 
> more detail. One question I had was around the changes to remove one of the 
> overloads of `mergeSort` (the one without a `Comparator` arg) from 
> `SortHelper.java`: I presume you have verified that you won't ever get an NPE 
> due to a null `Comparator`?

I checked all the call sites, and they never call it with a `null` as they 
check either just before or in the previous method if the comparator is `null` 
before going into that path, so the code that was removed wasn't (currently) in 
use (perhaps it was in the past).

The caller is now responsible for calling either a version that uses an 
explicit comparator (with the appropriate generic signature), or one that 
relies on the natural order of elements (ie. the elements implement 
`Comparable`).  I documented the methods to make sure (future) callers know 
what to expect.

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

PR: https://git.openjdk.org/jfx/pull/972

Reply via email to