RFR: 6187113: DefaultListSelectionModel.removeIndexInterval(0, Integer.MAX_VALUE) fails [v4]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Wed Oct 12 04:23:19 UTC 2022
On Fri, 7 Oct 2022 19:50:19 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> 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.
OK. Practically, it seems right as list probably may not have MAX_VALUE entries..Updated to exclude MAX_VALUE and updated the javadoc.
-------------
PR: https://git.openjdk.org/jdk/pull/10409
More information about the client-libs-dev
mailing list