RFR 8135248: Add utility methods to check indexes and ranges
Paul Sandoz
paul.sandoz at oracle.com
Thu Sep 24 09:30:22 UTC 2015
On 24 Sep 2015, at 11:06, Chris Hegarty <chris.hegarty at oracle.com> wrote:
> 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.
>
Yes, i was anticipating that.
> 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 …”
>
Updated (test also moved to a more appropriate location):
http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8135248-ioobe-check-index-range/webrev/
Thanks,
Paul.
More information about the core-libs-dev
mailing list