harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Li (JIRA)" <j...@apache.org>
Subject [jira] Assigned: (HARMONY-4398) [classlib][luni]AbstractList does not handle expectedModCount correctly
Date Thu, 12 Jul 2007 06:09:04 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-4398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Leo Li reassigned HARMONY-4398:
-------------------------------

    Assignee: Leo Li

> [classlib][luni]AbstractList does not handle expectedModCount correctly
> -----------------------------------------------------------------------
>
>                 Key: HARMONY-4398
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4398
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: spark shen
>            Assignee: Leo Li
>
> The following test case will pass on RI, but fail on Harmony
> import java.util.AbstractList;
> import java.util.ArrayList;
> import java.util.ConcurrentModificationException;
> import java.util.Iterator;
> import java.util.NoSuchElementException;
> public class MyArrayList<E> extends AbstractList<E> {
> 	/**
> 	 * 
> 	 */
> 	private static final long serialVersionUID = 1L;
> 	
> 	ArrayList<E> list = new ArrayList<E>();
> 	public static void main(String args[]) {
> 		MyArrayList<String> t = new MyArrayList<String>();
> 		t.list.add("a");
> 		t.list.add("b");
> 		
> 		Iterator it = t.iterator();
> 		
> 		while (it.hasNext()) {
> 			it.next();
> 		}
> 		try {
> 			it.next();
> 		} catch (NoSuchElementException cme) {
> 		}
> 		
> 		t.add("c");
> 		try {
> 			it.remove();
> 		} catch (ConcurrentModificationException cme) {
> 		}
> 		
> 		it = t.iterator();
> 		try {
> 			it.remove();
> 			System.out.println("should throw IllegalStateException");
> 		} catch (IllegalStateException ise) {
> 		}
> 		try {
> 			it.next();
> 			System.out.println("Passed");
> 		} catch (ConcurrentModificationException ise) {
> 			System.out.println("Failed");
> 		}
> 	}
> 	
> 	public E remove(int idx) {
> 		modCount++;
> 		return list.remove(idx);
> 	}
> 	@Override
> 	public E get(int index) {
> 		return list.get(index);
> 	}
> 	@Override
> 	public int size() {
> 		return list.size();
> 	}
> 	
> 	public void add(int idx, E o) {
> 		modCount++;
> 		list.add(idx, o);
> 	}
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message