RFR 8135248: Add utility methods to check indexes and ranges

Chris Hegarty chris.hegarty at oracle.com
Thu Sep 24 09:06:36 UTC 2015

On 24 Sep 2015, at 08:40, Paul Sandoz <paul.sandoz at oracle.com> wrote:

> On 23 Sep 2015, at 18:11, Rémi Forax <forax at univ-mlv.fr> wrote:
>>> Because i want to support the simple cases without pulling in indy.
>> and what about using an anonymous class instead ?
> Not an anonymous one, but i think i know what you mean :-)
> Also, i don’t want to impose a null check of the exception mapping function for every call, which would push the null check to when the values are out of bounds, and throwing an NPE in such cases seems mean when one can easily throw IOOBE instead.

This does seem to be one of the rare cases where accepting null is the lesser of two evils, given the expected usage of the API.

A few other minor comments:

 1)  “.. are provided for the convenience of checking if values
       corresponding TO indexes and sub-ranges are out of bounds.”

 2) @since 9 ?? Is this the expected release value given Verona.

 3) Trailing DOT
     77      * @param a the first out of bound valueDOT
     78      * @param b the second out of bound valueDOT

 4) "MapS out of bounds values to a runtime exceptionS."

 5) "CheckS if the {@code index} is within…"

 6) ArrayIndexOutOfBoundsException
     "Constructs … CLASS WITH WITH …"


More information about the core-libs-dev mailing list