diff --git a/src/changes/changes.xml b/src/changes/changes.xml index c86190789..28ad20f22 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -22,6 +22,9 @@
+ * This implementation does not forward the hashCode and equals methods through
+ * to the backing object, but relies on Object's implementation. This is necessary
+ * to preserve the symmetry of equals. Custom definitions of equality are usually
+ * based on an interface, such as Set or List, so that the implementation of equals
+ * can cast the object being tested for equality to the custom interface.
+ * AbstractCollectionDecorator does not implement such custom interfaces directly;
+ * they are implemented only in subclasses. Therefore, forwarding equals would break
+ * symmetry, as the forwarding object might consider itself equal to the object being
+ * tested, but the reverse could not be true. This behavior is consistent with the
+ * JDK's collection wrappers, such as {@link java.util.Collections#unmodifiableCollection(Collection)}.
+ * Use an interface-specific subclass of AbstractCollectionDecorator, such as
+ * AbstractListDecorator, to preserve equality behavior, or override equals directly.
*
* @param
* Methods are forwarded directly to the decorated queue.
+ *
+ * This implementation does not forward the hashCode and equals methods through
+ * to the backing object, but relies on Object's implementation. This is
+ * necessary as some Queue implementations, e.g. LinkedList, have custom a
+ * equals implementation for which symmetry can not be preserved.
+ * See class javadoc of AbstractCollectionDecorator for more information.
*
* @param