On Wed, 28 Sep 2022 09:41:02 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
wrote:

> To remove an index, I guess we need to first do setSelection where we will 
> already throw IOOBE so I guess that's why this method does not mention or 
> handle it explicitly

It's not required by the implementation.


        selectionModel.setSelectionInterval(0, 1);
        selectionModel.removeIndexInterval(Integer.MIN_VALUE, -1);


works … that is the call to `removeIndexInterval` throws the 
`IndexOutOfBoundsException` because it tries to copy the bits in the removed 
interval. If `rmMinIndex` is negative, the implementation may throw IOOBE 
before doing other work as an optimisation or rely on it being thrown from the 
code below as it does now.

Other methods specify the behaviour for negative parameters, this method would 
benefit from it too.

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

PR: https://git.openjdk.org/jdk/pull/10409

Reply via email to