-
Bug
-
Resolution: Fixed
-
P2
-
7
-
None
-
b17
-
generic
-
generic
This program:
public class Bug34 {
public static void main(String[] args) throws Throwable {
java.util.List x
= new java.util.concurrent.CopyOnWriteArrayList().subList(0,0);
x.add("foo");
x.remove("foo");
assert(x.isEmpty());
}
}
throws
Exception in thread "main" java.lang.UnsupportedOperationException
at java.util.concurrent.CopyOnWriteArrayList$COWSubListIterator.remove(CopyOnWriteArrayList.java:1297)
at java.util.AbstractCollection.remove(AbstractCollection.java:270)
at Bug34.main(Bug34.java:6)
which violates the invariant that if add(x) succeeds, then remove(x) should as well.
Also, that if remove(int) is supported, then remove(Object) should also be.
public class Bug34 {
public static void main(String[] args) throws Throwable {
java.util.List x
= new java.util.concurrent.CopyOnWriteArrayList().subList(0,0);
x.add("foo");
x.remove("foo");
assert(x.isEmpty());
}
}
throws
Exception in thread "main" java.lang.UnsupportedOperationException
at java.util.concurrent.CopyOnWriteArrayList$COWSubListIterator.remove(CopyOnWriteArrayList.java:1297)
at java.util.AbstractCollection.remove(AbstractCollection.java:270)
at Bug34.main(Bug34.java:6)
which violates the invariant that if add(x) succeeds, then remove(x) should as well.
Also, that if remove(int) is supported, then remove(Object) should also be.