On 21 September 2015 at 15:28, Paul Sandoz <paul.san...@oracle.com> wrote:
>> It would seem very worthwhile to add overloaded versions of each of
>> these methods that do not have the OutOfBoundsToException in the
>> argument list. Instead, these overloads would throw a "standard"
>> exception.
>
> That seems reasonable e.g.:
>
> public static
> int checkIndex(int index, int length) IndexOutOfBoundsException {
>     return checkIndex(index, length, null);
> }
>
>> Such methods would then be much more amenable to just being
>> dropped into existing application code, where the precise exception
>> that is thrown is less of a concern.
> Though is passing “null” such a big deal?

Best to try and avoid asking application developers to pass null in to
get a special behaviour. In fact, the method could even reject null
and throw an exception, which would make more sense.

I agree with Remi on naming at least - a functional interface ending
"Exception" is likely to be confusing.

Stephen

Reply via email to