# HG changeset patch # User Frank Benoit # Date 1221856624 -7200 # Node ID 9008cb2f47c5f81e991cf79505839f1ad5dfe212 # Parent 1470d66733fa4b7efd104b66f6788021c4e7f210 Fix tango.core.Array.remove use diff -r 1470d66733fa -r 9008cb2f47c5 dwtx/dwtxhelper/Bean.d --- a/dwtx/dwtxhelper/Bean.d Mon Sep 15 03:42:10 2008 +0200 +++ b/dwtx/dwtxhelper/Bean.d Fri Sep 19 22:37:04 2008 +0200 @@ -79,7 +79,7 @@ } void removePropertyChangeListener(String propertyName, PropertyChangeListener listener){ if( auto list = propertyName in listeners ){ - tango.core.Array.remove( *list, listener ); + list.length = tango.core.Array.remove( *list, listener ); if( list.length > 0 ){ listeners[ propertyName.dup ] = *list; } diff -r 1470d66733fa -r 9008cb2f47c5 dwtx/dwtxhelper/Collection.d --- a/dwtx/dwtxhelper/Collection.d Mon Sep 15 03:42:10 2008 +0200 +++ b/dwtx/dwtxhelper/Collection.d Fri Sep 19 22:37:04 2008 +0200 @@ -2184,6 +2184,9 @@ } class Collections { + private static void unsupported(){ + throw new UnsupportedOperationException(); + } private static List EMPTY_LIST_; public static List EMPTY_LIST(){ @@ -2218,6 +2221,167 @@ } return EMPTY_SET_; } + static class UnmodifiableIterator : Iterator { + Iterator it; + this(Iterator it){ + this.it = it; + } + public bool hasNext(){ + return it.hasNext(); + } + public Object next(){ + return it.next(); + } + public void remove(){ + unsupported(); + } + } + static class UnmodifiableListIterator : ListIterator { + ListIterator it; + this(ListIterator it){ + this.it = it; + } + public void add(Object o){ + unsupported(); + } + public bool add(String o){ + unsupported(); + return false; // make compiler happy + } + public bool hasNext(){ + return it.hasNext(); + } + public bool hasPrevious(){ + return it.hasPrevious(); + } + public Object next(){ + return it.next(); + } + public int nextIndex(){ + return it.nextIndex(); + } + public Object previous(){ + return it.previous(); + } + public int previousIndex(){ + return it.previousIndex(); + } + public void remove(){ + unsupported(); + } + public void set(Object o){ + unsupported(); + } + } + static class UnmodifieableList : List { + List list; + this(List list){ + this.list = list; + } + public void add(int index, Object element){ + unsupported(); + } + public bool add(Object o){ + unsupported(); + return false; // make compiler happy + } + public bool add(String o){ + unsupported(); + return false; // make compiler happy + } + public bool addAll(Collection c){ + unsupported(); + return false; // make compiler happy + } + public bool addAll(int index, Collection c){ + unsupported(); + return false; // make compiler happy + } + public void clear(){ + unsupported(); + return false; // make compiler happy + } + public bool contains(Object o){ + return list.contains(o); + } + public bool contains(String o){ + return list.contains(o); + } + public bool containsAll(Collection c){ + return list.containsAll(c); + } + public int opEquals(Object o){ + return list.opEquals(o); + } + public Object get(int index){ + return list.get(index); + } + public hash_t toHash(){ + return list.toHash(); + } + public int indexOf(Object o){ + return list.indexOf(o); + } + public bool isEmpty(){ + return list.isEmpty(); + } + public Iterator iterator(){ + return new UnmodifiableIterator( list.iterator() ); + } + public int lastIndexOf(Object o){ + return list.lastIndexOf(o); + } + public ListIterator listIterator(){ + return new UnmodifiableListIterator( list.listIterator() ); + } + public ListIterator listIterator(int index){ + return new UnmodifiableListIterator( list.listIterator(index) ); + } + public Object remove(int index){ + unsupported(); + return null; // make compiler happy + } + public bool remove(Object o){ + unsupported(); + return false; // make compiler happy + } + public bool remove(String o){ + unsupported(); + return false; // make compiler happy + } + public bool removeAll(Collection c){ + unsupported(); + return false; // make compiler happy + } + public bool retainAll(Collection c){ + unsupported(); + return false; // make compiler happy + } + public Object set(int index, Object element){ + unsupported(); + return null; // make compiler happy + } + public int size(){ + return list.size(); + } + public List subList(int fromIndex, int toIndex){ + return new UnmodifieableList( list.subList(fromIndex,toIndex)); + } + public Object[] toArray(){ + return list.toArray(); + } + public Object[] toArray(Object[] a){ + return list.toArray(a); + } + public int opApply (int delegate(ref Object value) dg){ + implMissing(__FILE__, __LINE__ ); + return 0; + } + public int opApply (int delegate(ref Object key, ref Object value) dg){ + implMissing(__FILE__, __LINE__ ); + return 0; + } + } static int binarySearch(List list, Object key){ implMissing( __FILE__, __LINE__ ); return 0; @@ -2227,8 +2391,7 @@ return 0; } public static List unmodifiableList( List list ){ - implMissing( __FILE__, __LINE__ ); - return null; + return new UnmodifieableList(list); } public static Map unmodifiableMap( Map list ){ implMissing( __FILE__, __LINE__ );