RFR [8014066] Mistake in documentation of ArrayList#removeRange
roger riggs
roger.riggs at oracle.com
Mon Mar 17 13:51:38 UTC 2014
Hi Ivan,
Just to see the effect of the change, I ran the test without the code
change and it reported
331 failures and only 1 IndexOutOfBoundsException not thrown and that
was in java.util.Collections$SingletonMap.
(I can't appreciate the error reporting style with just a stack trace;
especially given the generated cases in nested loops).
I would have expected to see failures reporting the incorrect exception
being thrown for ArrayList itself.
Though most are likely due to the same condition outside the range, its
hard to tell if there are other failures.
Can you check that the test is detecting and reporting the right errors
for the current implementation.
Thanks, Roger
On 3/16/2014 6:37 PM, Ivan Gerasimov wrote:
> Here is yet another iteration of the fix:
> http://cr.openjdk.java.net/~igerasim/8014066/3/webrev/
>
> 1)
> The condition 'fromIndex >= size()' is removed from the spec.
> I prefer removing it rather than replacing it with 'fromIndex >
> size()' for two reasons:
> - 'fromIndex > size()' already follows on from two other conditions
> (toIndex > size() || toIndex < fromIndex);
> - it is consistent with the spec for CopyOnWriteArrayList#removeRange().
>
> 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?
>
> 3)
> Moved the test to MOAT.java
> The test looks a bit foreign over there, but reuses some of the
> infrastructure.
>
> Sincerely yours,
> Ivan
>
More information about the core-libs-dev
mailing list