On Fri, 7 Oct 2022 08:49:09 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
wrote:

>> I suggest amending `setSelectionInterval` to throw IOOBE if 
>> `Integer.MAX_VALUE` is passed.
>> 
>> Then I suggest amending `removeIndexInterval` to throw IOOBE if a negative 
>> value is passed or an index is `Integer.MAX_VALUE`. Explicit handling of 
>> negative values could be an optimisation made in addition to handling 
>> `MAX_VALUE`.
>> 
>> In both cases, the spec needs to be updated, and therefore the CSR will be 
>> required.
>
> I guess Integer.MAX_VALUE should be valid "int" value, its because of 
> internal calculation which is causing it to overflow so I guess we should not 
> update the spec for wrongful calculation. 
> I have fixed the overflow in setSelectionInterval.

This is not a generic class, its main purpose is to handle list selection in UI 
components, such as `JList`. Excluding `Integer.MAX_VALUE` makes sense to me, 
it simplifies the code: no additional check in the loop and no special handling 
`removeIndexInterval` which also adds a condition to the loop.

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

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

Reply via email to