public inbox for mauve-discuss@sourceware.org
 help / color / mirror / Atom feed
* set(int, Object), Iterator and ConcurrentModificationException
@ 2002-04-05  8:41 Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2002-04-05  8:41 UTC (permalink / raw)
  To: mauve-discuss

[-- Attachment #1: Type: text/plain, Size: 854 bytes --]



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

[-- Attachment #2: Concurrent.patch --]
[-- Type: text/x-patch, Size: 3589 bytes --]

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();

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-04-05 16:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-05  8:41 set(int, Object), Iterator and ConcurrentModificationException Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).