You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Stephen Colebourne <sc...@btopenworld.com> on 2004/05/05 01:22:22 UTC

Re: [collections] Backwards compatability 3.0 to 2.1

Collections 3.0 is SOURCE and TEST compatible with 2.1 via deprecation (see
below).

The following BINARY incompatabilities were present and not noted in the
release notes (I've just manually checked for them):

Important:
The following IteratorUtils methods changed return type causing errors when
linking:
IteratorUtils.arrayIterator(Object[])
IteratorUtils.arrayIterator(Object[], int)
IteratorUtils.arrayIterator(Object[], int, int)
 - solution: use new ArrayIterator(Object[], int, int)
IteratorUtils.singletonIterator()
 - solution: use new SingletonIterator(object)
IteratorUtils.emptyIterator()
IteratorUtils.emptyListIterator()
IteratorUtils.EMPTY_ITERATOR
IteratorUtils.EMPTY_LIST_ITERATOR
- no solution

All methods/classes deprecated in 2.1 were removed.

Maybe important:
BufferUnderflowException now extends NoSuchElementException instead of just
RuntimeException

Not so important:
BeanMap.MyMapEntry  no longer extends DefaultMapEntry
FilterIterator no longer extends ProxyIterator
FilterListIterator no longer extends ProxyListIterator
TransformIterator no longer extends ProxyIterator


The main issue is that IteratorUtils got screwed up. Solutions are given
above for most of the methods (ie. the solution works in both 2.1 and 3.0.
The empty iterators are just plain screwed though. This is exactly why we
need a binary compatability checker.

Stephen

----- Original Message -----
From: "Stephen Colebourne" <sc...@btopenworld.com>
> I took the time to run Collections 3.0 against the Collections 2.1 tests.
> IT PASSED  ;-)
>
>
> This is the full details of the 3 'failures':
>
> ArrayIterator 'failure':
> new ArrayIterator(Object,1,1) should throw an IllegalArgumentException
>
.collections.iterators.TestArrayIterator2.testIndexedArray(TestArrayIterator
> 2.java:203)
> Reason - Collections 3.0 enhanced constructor to allow iteration over a
zero
> length array.
> Backwards compatible unless caller relied on error.
>
> UniqueFilterIterator 'failure':
> java.lang.IllegalStateException
>  java.util.AbstractList$Itr.remove(AbstractList.java:428)
> .collections.iterators.FilterIterator.remove(FilterIterator.java:126)
>
.collections.iterators.TestUniqueFilterIterator.testRemove(TestUniqueFilterI
> terator.java:153)
> Reason - Collections 3.0 enhanced UniqueFilterIterator to allow remove()
> Backwards compatible unless caller relied on error.
>
> PredicatedMap 'failure':
> Reason - Collections 3.0 fixed a bug whereby the toArray() method wasn't
> protected by the predicate
> Backwards compatible unless caller relied on bug.
>
> Stephen
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org