I think we need a few more tests to be sure that sublists are working as
intended.  If things are problematic after adding more tests, another
approach that might help would be to move the fromIndex and toIndex
fields into AbstractList -- then fix every list operation to respect
those bounds rather than using 0 and array.length or whatever.  Then
sublist becomes trivial.


http://gwt-code-reviews.appspot.com/620802/diff/8001/9002
File user/test/com/google/gwt/emultest/java/util/ListTestBase.java
(right):

http://gwt-code-reviews.appspot.com/620802/diff/8001/9002#newcode199
user/test/com/google/gwt/emultest/java/util/ListTestBase.java:199:
public void testSubList() {
My concern is that since there is no overriden version of
remove(Object), the superclass version won't respect fromIndex and
toIndex, so it will remove the element from the base list even though it
is not part of the sublist.

It's possible that this works fine -- I haven't tried to examine all the
superclass code -- but in any case I would like to see it as part of the
test case.

http://gwt-code-reviews.appspot.com/620802/diff/8001/9002#newcode212
user/test/com/google/gwt/emultest/java/util/ListTestBase.java:212:
assertEquals(testList, Arrays.asList(2, 6, 4));
OK

http://gwt-code-reviews.appspot.com/620802/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to