RFR 8135248: Add utility methods to check indexes and ranges
Paul Sandoz
paul.sandoz at oracle.com
Tue Sep 29 08:44:20 UTC 2015
> On 29 Sep 2015, at 06:48, John Rose <john.r.rose at oracle.com> wrote:
>
> On Sep 28, 2015, at 5:10 PM, Joseph D. Darcy <joe.darcy at oracle.com <mailto:joe.darcy at oracle.com>> wrote:
>>
>> Joining this thread late, I think the range checking methods would have a happier life where they are more often found and used if the they live somewhere other than the exception classes.
>>
>> The class java.util.Objects is not an ideal host for these methods, since they don't deal directly with objects per se, but the scope of Objects could be expanded to include these utilities as well.
>
> You have a point, that's probably a better bikeshed.
>
No objections :-) I think it’s a better location to find such methods. Moved, and i also tweaked to class doc of Objects to include static methods for “checking certain conditions before operation”.
> Since the key operation is an integer compare, putting it on Integer (near compare) would also be defensible.
>
> (The new factory methods for exceptions make sense on the exceptions themselves, of course.)
>
I clarified the exception constructors that access one to two out of band values to say they are included in the exception detail message (without actually specifying the presentation format of that message).
http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8135248-ioobe-check-index-range/webrev/ <http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8135248-ioobe-check-index-range/webrev/>
http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8135248-ioobe-check-index-range/specdiff/overview-summary.html <http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8135248-ioobe-check-index-range/specdiff/overview-summary.html>
Paul.
More information about the core-libs-dev
mailing list