commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Heuer <heue...@acm.org>
Subject Re: [collections] Bag interface
Date Mon, 26 Apr 2004 15:57:40 GMT

On Mon, 26 Apr 2004, Stephen Colebourne wrote:

> The current Bag interface has the following javadoc warning:
>
>  * <i>Note that this interface violates the {@link Collection} contract.</i>
>  * The behavior specified in many of these methods is <i>not</i> the same
>  * as the behavior specified by <code>Collection</code>.  The noncompliant
> methods
>  * are clearly marked with "(Violation)".  A future
>  * version of this class will specify the same behavior as
> <code>Collection</code>,
>  * which unfortunately will break backwards compatibility with this version.
>
> This has caused bile-like derision in some quarters, and is not something
> I've ever liked - its basically an artifact of collections history.
>
> I propose that we change this to state that its wrong, but that we will keep
> compatability:
>
>  * <i>NOTE: This interface violates the {@link Collection} contract.</i>
>  * The behavior specified in many of these methods is <i>not</i> the same
>  * as the behavior specified by <code>Collection</code>.
>  * The noncompliant methods are clearly marked with "(Violation)".
>  * Exercise caution when using a bag as a <code>Collection</code>.
>  * <p>
>  * This violation resulted from the original specification of the interface.
>  * In an ideal world, the interface would be changed to fix the problems,
> however
>  * it has been decided to maintain backwards compatibility instead.
>
> Opinions?

How about creating a Bag2 (or a better name) interface that does not
violate the Collection contract and deprecating Bag and friends?

   michael


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


Mime
View raw message