diff --git a/src/main/java/org/apache/commons/collections/bag/AbstractMapBag.java b/src/main/java/org/apache/commons/collections/bag/AbstractMapBag.java index 3418e12c0..05e5c7500 100644 --- a/src/main/java/org/apache/commons/collections/bag/AbstractMapBag.java +++ b/src/main/java/org/apache/commons/collections/bag/AbstractMapBag.java @@ -488,7 +488,7 @@ public abstract class AbstractMapBag implements Bag { /** * Write the map out using a custom routine. * @param out the output stream - * @throws IOException + * @throws IOException any of the usual I/O related exceptions */ protected void doWriteObject(ObjectOutputStream out) throws IOException { out.writeInt(map.size()); @@ -503,12 +503,12 @@ public abstract class AbstractMapBag implements Bag { * Read the map in using a custom routine. * @param map the map to use * @param in the input stream - * @throws IOException - * @throws ClassNotFoundException + * @throws IOException any of the usual I/O related exceptions + * @throws ClassNotFoundException if the stream contains an object which class can not be loaded * @throws ClassCastException if the stream does not contain the correct objects */ - protected void doReadObject(Map map, ObjectInputStream in) throws IOException, - ClassNotFoundException { + protected void doReadObject(Map map, ObjectInputStream in) + throws IOException, ClassNotFoundException { this.map = map; int entrySize = in.readInt(); for (int i = 0; i < entrySize; i++) { diff --git a/src/main/java/org/apache/commons/collections/bag/HashBag.java b/src/main/java/org/apache/commons/collections/bag/HashBag.java index 4f46ca5ce..3c2bab8a2 100644 --- a/src/main/java/org/apache/commons/collections/bag/HashBag.java +++ b/src/main/java/org/apache/commons/collections/bag/HashBag.java @@ -38,8 +38,7 @@ import org.apache.commons.collections.Bag; * @since 3.0 (previously in main package v2.0) * @version $Id$ */ -public class HashBag - extends AbstractMapBag implements Bag, Serializable { +public class HashBag extends AbstractMapBag implements Bag, Serializable { /** Serial version lock */ private static final long serialVersionUID = -6561115435802554013L; diff --git a/src/main/java/org/apache/commons/collections/bag/PredicatedBag.java b/src/main/java/org/apache/commons/collections/bag/PredicatedBag.java index caac5a109..5c46d3984 100644 --- a/src/main/java/org/apache/commons/collections/bag/PredicatedBag.java +++ b/src/main/java/org/apache/commons/collections/bag/PredicatedBag.java @@ -38,8 +38,7 @@ import org.apache.commons.collections.collection.PredicatedCollection; * @since 3.0 * @version $Id$ */ -public class PredicatedBag - extends PredicatedCollection implements Bag { +public class PredicatedBag extends PredicatedCollection implements Bag { /** Serialization version */ private static final long serialVersionUID = -2575833140344736876L; diff --git a/src/main/java/org/apache/commons/collections/bag/PredicatedSortedBag.java b/src/main/java/org/apache/commons/collections/bag/PredicatedSortedBag.java index 968c3717c..0f866aa7f 100644 --- a/src/main/java/org/apache/commons/collections/bag/PredicatedSortedBag.java +++ b/src/main/java/org/apache/commons/collections/bag/PredicatedSortedBag.java @@ -37,8 +37,7 @@ import org.apache.commons.collections.SortedBag; * @since 3.0 * @version $Id$ */ -public class PredicatedSortedBag - extends PredicatedBag implements SortedBag { +public class PredicatedSortedBag extends PredicatedBag implements SortedBag { /** Serialization version */ private static final long serialVersionUID = 3448581314086406616L; diff --git a/src/main/java/org/apache/commons/collections/bag/SynchronizedBag.java b/src/main/java/org/apache/commons/collections/bag/SynchronizedBag.java index bc1a15f05..8150a1d0f 100644 --- a/src/main/java/org/apache/commons/collections/bag/SynchronizedBag.java +++ b/src/main/java/org/apache/commons/collections/bag/SynchronizedBag.java @@ -34,8 +34,7 @@ import org.apache.commons.collections.set.SynchronizedSet; * @since 3.0 * @version $Id$ */ -public class SynchronizedBag - extends SynchronizedCollection implements Bag { +public class SynchronizedBag extends SynchronizedCollection implements Bag { /** Serialization version */ private static final long serialVersionUID = 8084674570753837109L; diff --git a/src/main/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java b/src/main/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java index df5cc4fdd..40b0b76d0 100644 --- a/src/main/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java +++ b/src/main/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java @@ -33,8 +33,7 @@ import org.apache.commons.collections.SortedBag; * @since 3.0 * @version $Id$ */ -public class SynchronizedSortedBag - extends SynchronizedBag implements SortedBag { +public class SynchronizedSortedBag extends SynchronizedBag implements SortedBag { /** Serialization version */ private static final long serialVersionUID = 722374056718497858L; diff --git a/src/main/java/org/apache/commons/collections/bag/TransformedBag.java b/src/main/java/org/apache/commons/collections/bag/TransformedBag.java index fd48c3a6f..27829d0ca 100644 --- a/src/main/java/org/apache/commons/collections/bag/TransformedBag.java +++ b/src/main/java/org/apache/commons/collections/bag/TransformedBag.java @@ -36,8 +36,7 @@ import org.apache.commons.collections.set.TransformedSet; * @since 3.0 * @version $Id$ */ -public class TransformedBag - extends TransformedCollection implements Bag { +public class TransformedBag extends TransformedCollection implements Bag { /** Serialization version */ private static final long serialVersionUID = 5421170911299074185L; diff --git a/src/main/java/org/apache/commons/collections/bag/TransformedSortedBag.java b/src/main/java/org/apache/commons/collections/bag/TransformedSortedBag.java index 26572b230..96b99c163 100644 --- a/src/main/java/org/apache/commons/collections/bag/TransformedSortedBag.java +++ b/src/main/java/org/apache/commons/collections/bag/TransformedSortedBag.java @@ -34,8 +34,7 @@ import org.apache.commons.collections.Transformer; * @since 3.0 * @version $Id$ */ -public class TransformedSortedBag - extends TransformedBag implements SortedBag { +public class TransformedSortedBag extends TransformedBag implements SortedBag { /** Serialization version */ private static final long serialVersionUID = -251737742649401930L; diff --git a/src/main/java/org/apache/commons/collections/bag/TreeBag.java b/src/main/java/org/apache/commons/collections/bag/TreeBag.java index 855b55d0a..094a784a3 100644 --- a/src/main/java/org/apache/commons/collections/bag/TreeBag.java +++ b/src/main/java/org/apache/commons/collections/bag/TreeBag.java @@ -77,7 +77,12 @@ public class TreeBag extends AbstractMapBag implements SortedBag, Seria } //----------------------------------------------------------------------- - // TODO: Generics - should this be E or some such? + /** + * {@inheritDoc} + * + * @throws IllegalArgumentException if the object to be added does not implement + * {@link Comparable} and the {@link TreeBag} is using natural ordering + */ @Override public boolean add(E object) { if(comparator() == null && !(object instanceof Comparable)) {