RFR [8014066] Mistake in documentation of ArrayList#removeRange

Ivan Gerasimov ivan.gerasimov at oracle.com
Mon Mar 17 06:03:37 UTC 2014

On 17.03.2014 2:52, Ulf Zibis wrote:
> Am 16.03.2014 23:37, schrieb Ivan Gerasimov:
>> Here is yet another iteration of the fix:
>> http://cr.openjdk.java.net/~igerasim/8014066/3/webrev/
>> 2)
>> Kept the check for 'fromIndex > toIndex' in removeRange().
>> While I understand that this should not add anything significant to 
>> the current code, as currently removeRange() is always called with 
>> valid arguments.
>> However, if it is stated in the spec that in case of 'fromIndex > 
>> toIndex' an exception is thrown, I believe it should be thrown, 
>> otherwise why it's stated?
> Isn't this a perfect situation to use an assert statement? Needless to 
> say, then the spec must be adapted.

Yeah, it might be more fair to write that it's assumed that the passed 
arguments are valid and use asserts as you suggest.
Though I think that the current trend is to do as little modifications 
as possible.

Sincerely yours,

> -Ulf

More information about the core-libs-dev mailing list