RFR [8014066] Mistake in documentation of ArrayList#removeRange
Ivan Gerasimov
ivan.gerasimov at oracle.com
Sun Mar 16 22:37:41 UTC 2014
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