This is the mail archive of the mauve-discuss@sources.redhat.com mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

set(int, Object), Iterator and ConcurrentModificationException




Hi,

We seem to have consensus on the gcj mailinglist that
ConcurrentModificationExceptions should only be thrown for structural
changes on an underlying collection while using an Iterator. This means
that it is 'save' to use set(int,Object) on Lists.

2002-04-05  Mark Wielaard  <mark@klomp.org>

	* gnu/testlet/java/util/ArrayList/AcuniaArrayListTest.java
	(test_MC_iterator): Remove ConcurrentModificationException check for
	set(int,Object).
	* gnu/testlet/java/util/LinkedList/AcuniaLinkedListTest.java
	(test_iterator): Likewise.
	* gnu/testlet/java/util/AbstractSequentialList/AcuniaAbstractSequentialListTest.java
	(test_iterator): Likewise.
	* gnu/testlet/java/util/Vector/AcuniaVectorTest.java
	(test_iterator): Likewise and also for setElementAt(Object,int)

Kaffe, gcj and the Sun JDK behave the same way. What do you think?

Cheers,

Mark
Index: gnu/testlet/java/util/ArrayList/AcuniaArrayListTest.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/util/ArrayList/AcuniaArrayListTest.java,v
retrieving revision 1.2
diff -u -r1.2 AcuniaArrayListTest.java
--- AcuniaArrayListTest.java	2002/04/03 08:28:47	1.2
+++ AcuniaArrayListTest.java	2002/04/05 16:36:46
@@ -625,13 +625,6 @@
         }
     catch(ConcurrentModificationException ioobe) { th.check(true); }
     it = al.iterator();
-    al.set(2,xal);
-    try {
-    	it.next();
-        th.fail("should throw a ConcurrentModificationException -- 7");
-        }
-    catch(ConcurrentModificationException ioobe) { th.check(true); }
-    it = al.iterator();
     al.remove(2);
     try {
     	it.next();
Index: gnu/testlet/java/util/LinkedList/AcuniaLinkedListTest.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/util/LinkedList/AcuniaLinkedListTest.java,v
retrieving revision 1.1
diff -u -r1.1 AcuniaLinkedListTest.java
--- AcuniaLinkedListTest.java	2001/03/16 09:43:17	1.1
+++ AcuniaLinkedListTest.java	2002/04/05 16:36:46
@@ -498,13 +498,6 @@
         }
     catch(ConcurrentModificationException ioobe) { th.check(true); }
     it = al.iterator();
-    al.set(2,buildAL());
-    try {
-    	it.next();
-        th.fail("should throw a ConcurrentModificationException -- 7");
-        }
-    catch(ConcurrentModificationException ioobe) { th.check(true); }
-    it = al.iterator();
     al.remove(2);
     try {
     	it.next();
Index: gnu/testlet/java/util/AbstractSequentialList/AcuniaAbstractSequentialListTest.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/util/AbstractSequentialList/AcuniaAbstractSequentialListTest.java,v
retrieving revision 1.2
diff -u -r1.2 AcuniaAbstractSequentialListTest.java
--- AcuniaAbstractSequentialListTest.java	2002/04/03 21:19:46	1.2
+++ AcuniaAbstractSequentialListTest.java	2002/04/05 16:36:46
@@ -450,13 +450,6 @@
         }
     catch(ConcurrentModificationException ioobe) { th.check(true); }
     it = al.iterator();
-    al.set(2,buildAL());
-    try {
-    	it.next();
-        th.fail("should throw a ConcurrentModificationException -- 7");
-        }
-    catch(ConcurrentModificationException ioobe) { th.check(true); }
-    it = al.iterator();
     al.remove(2);
     try {
     	it.next();
Index: gnu/testlet/java/util/Vector/AcuniaVectorTest.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/util/Vector/AcuniaVectorTest.java,v
retrieving revision 1.3
diff -u -r1.3 AcuniaVectorTest.java
--- AcuniaVectorTest.java	2002/04/03 08:28:48	1.3
+++ AcuniaVectorTest.java	2002/04/05 16:36:46
@@ -1508,20 +1508,6 @@
     	}
     catch(ConcurrentModificationException cme) { th.check(true, "Ok -- 13"); }
     it = v.iterator();	
-    v.set(2,"a");
-    try {
-    	it.next();
-    	th.fail("should throw a ConcurrentModificationException -- set");
-    	}
-    catch(ConcurrentModificationException cme) { th.check(true, "Ok -- 14"); }
-    it = v.iterator();	
-    v.setElementAt("a",1);
-    try {
-    	it.next();
-    	th.fail("should throw a ConcurrentModificationException -- setElementAt");
-    	}
-    catch(ConcurrentModificationException cme) { th.check(true, "Ok -- 15"); }
-    it = v.iterator();	
     v.setSize(v.size()-2);
     try {
     	it.next();

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]