public inbox for mauve-discuss@sourceware.org
 help / color / mirror / Atom feed
* AcuniaAbstractListTest fixes
@ 2002-04-06  8:47 Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2002-04-06  8:47 UTC (permalink / raw)
  To: mauve-discuss

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

Hi,

I made the following changes to AcuniaAbstractListTest.

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

    * gnu/testlet/java/util/AbstractList/AcuniaAbstractListTest.java
    (test_iterator): Second hasNext() ConcurrentModificationException 
    check removed.
    (add): Only update modCount when edit == true.
    (set): Never update modCount.

When an Iterator throws a ConcurrentModificationException once it is
allowed to always throw that exception on successive call. Since
super.add() already updates the modCount it should not be updated a
second time. set() should not increase modCount according to:
http://java.sun.com/products/jdk/1.2/docs/api/java/util/AbstractList.html#modCount

Does someone disagree?

Cheers,

Mark

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

Index: gnu/testlet/java/util/AbstractList/AcuniaAbstractListTest.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/util/AbstractList/AcuniaAbstractListTest.java,v
retrieving revision 1.2
diff -u -r1.2 AcuniaAbstractListTest.java
--- AcuniaAbstractListTest.java	2002/04/03 21:19:44	1.2
+++ AcuniaAbstractListTest.java	2002/04/06 16:35:15
@@ -310,12 +310,6 @@
     	th.fail("should throw a ConcurrentModificationException -- 2");
     	}
     catch(ConcurrentModificationException cme) { th.check(true, "next"); }
-    try  {
-    	th.check(it.hasNext());
-    	}
-    catch(ConcurrentModificationException cme) {     	
-    	th.fail("should not throw a ConcurrentModificationException -- 3");
-    }
     it = eal.iterator();
     try {
     	it.remove();	
@@ -534,10 +528,10 @@
 	
 	public void add(int idx, Object o) {
 		if (edit) {
+			if (updateMC) modCount++;
 		 	v.add(idx , o);
 		}
 		else super.add(idx,o);
-		if (updateMC) modCount++;
 	}
 
 	public Object remove(int idx) {
@@ -551,7 +545,6 @@
 	
 	public Object set(int idx , Object o) {
 		if (edit) {
-			if (updateMC) modCount++;
 			return v.set(idx , o);
 		}
 		return super.set(idx , o);

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

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

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-06  8:47 AcuniaAbstractListTest fixes 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).