From 2d2aefe3613c2b80b24d55331aa806ddbeca6b09 Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Wed, 21 Jul 2010 19:07:52 +0000 Subject: [PATCH] Fix up generics and other warnings git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@966368 13f79535-47bb-0310-9956-ffa450edef68 --- .../commons/collections/CollectionUtils.java | 1 - .../commons/collections/IteratorUtils.java | 17 ++++++++--------- .../commons/collections/bag/AbstractMapBag.java | 8 +++----- .../collections/bidimap/DualTreeBidiMap.java | 10 +++++----- .../collections/buffer/BlockingBuffer.java | 1 - .../comparators/ComparableComparator.java | 1 - .../comparators/FixedOrderComparator.java | 2 +- .../collections/functors/ChainedClosure.java | 2 +- .../functors/InstantiateTransformer.java | 4 ++-- .../functors/InvokerTransformer.java | 4 ++-- .../iterators/EntrySetMapIterator.java | 2 +- .../iterators/ListIteratorWrapper.java | 12 ++++-------- .../collections/keyvalue/AbstractMapEntry.java | 3 +-- .../collections/keyvalue/DefaultKeyValue.java | 3 +-- .../collections/list/AbstractLinkedList.java | 9 ++++----- .../commons/collections/list/SetUniqueList.java | 2 +- .../collections/map/AbstractHashedMap.java | 9 ++++----- .../collections/map/AbstractReferenceMap.java | 3 +-- .../map/AbstractSortedMapDecorator.java | 4 ++-- .../commons/collections/map/CompositeMap.java | 3 +-- .../commons/collections/map/DefaultedMap.java | 2 +- .../map/EntrySetToMapIteratorAdapter.java | 2 +- .../commons/collections/map/Flat3Map.java | 2 +- .../apache/commons/collections/map/LazyMap.java | 2 +- .../commons/collections/map/MultiValueMap.java | 2 +- .../commons/collections/map/TransformedMap.java | 2 +- .../commons/collections/set/CompositeSet.java | 3 +-- .../collections/splitmap/TransformedMap.java | 2 +- 28 files changed, 50 insertions(+), 67 deletions(-) diff --git a/src/java/org/apache/commons/collections/CollectionUtils.java b/src/java/org/apache/commons/collections/CollectionUtils.java index ce02226aa..67358b024 100644 --- a/src/java/org/apache/commons/collections/CollectionUtils.java +++ b/src/java/org/apache/commons/collections/CollectionUtils.java @@ -127,7 +127,6 @@ public class CollectionUtils { * this purpose. However they could be cast to Set or List which might be * undesirable. This implementation only implements Collection. */ - @SuppressWarnings("unchecked") public static final Collection EMPTY_COLLECTION = UnmodifiableCollection.decorate(new ArrayList()); /** diff --git a/src/java/org/apache/commons/collections/IteratorUtils.java b/src/java/org/apache/commons/collections/IteratorUtils.java index 3d043d5a8..a0b7d9134 100644 --- a/src/java/org/apache/commons/collections/IteratorUtils.java +++ b/src/java/org/apache/commons/collections/IteratorUtils.java @@ -876,35 +876,34 @@ public class IteratorUtils { * @param obj the object to convert to an iterator * @return a suitable iterator, never null */ - @SuppressWarnings("unchecked") public static Iterator getIterator(Object obj) { if (obj == null) { return emptyIterator(); } if (obj instanceof Iterator) { - return (Iterator) obj; + return (Iterator) obj; } if (obj instanceof Collection) { - return ((Collection) obj).iterator(); + return ((Collection) obj).iterator(); } if (obj instanceof Object[]) { - return new ObjectArrayIterator((Object[]) obj); + return new ObjectArrayIterator((Object[]) obj); } if (obj instanceof Enumeration) { - return new EnumerationIterator((Enumeration) obj); + return new EnumerationIterator((Enumeration) obj); } if (obj instanceof Map) { - return ((Map) obj).values().iterator(); + return ((Map) obj).values().iterator(); } if (obj instanceof Dictionary) { - return new EnumerationIterator(((Dictionary) obj).elements()); + return new EnumerationIterator(((Dictionary) obj).elements()); } else if (obj.getClass().isArray()) { - return new ArrayIterator(obj); + return new ArrayIterator(obj); } try { Method method = obj.getClass().getMethod("iterator", (Class[]) null); if (Iterator.class.isAssignableFrom(method.getReturnType())) { - Iterator it = (Iterator) method.invoke(obj, (Object[]) null); + Iterator it = (Iterator) method.invoke(obj, (Object[]) null); if (it != null) { return it; } diff --git a/src/java/org/apache/commons/collections/bag/AbstractMapBag.java b/src/java/org/apache/commons/collections/bag/AbstractMapBag.java index 0892d4acf..37d209a4d 100644 --- a/src/java/org/apache/commons/collections/bag/AbstractMapBag.java +++ b/src/java/org/apache/commons/collections/bag/AbstractMapBag.java @@ -138,12 +138,11 @@ public abstract class AbstractMapBag implements Bag { * @param coll the collection to check against * @return true if the Bag contains all the collection */ - @SuppressWarnings("unchecked") public boolean containsAll(Collection coll) { if (coll instanceof Bag) { return containsAll((Bag) coll); } - return containsAll(new HashBag((Collection) coll)); + return containsAll(new HashBag(coll)); } /** @@ -208,7 +207,7 @@ public abstract class AbstractMapBag implements Bag { throw new ConcurrentModificationException(); } if (itemCount == 0) { - current = (Map.Entry) entryIterator.next(); + current = entryIterator.next(); itemCount = current.getValue().value; } canRemove = true; @@ -365,12 +364,11 @@ public abstract class AbstractMapBag implements Bag { * @param coll the collection to retain * @return true if this call changed the collection */ - @SuppressWarnings("unchecked") public boolean retainAll(Collection coll) { if (coll instanceof Bag) { return retainAll((Bag) coll); } - return retainAll(new HashBag((Collection) coll)); + return retainAll(new HashBag(coll)); } /** diff --git a/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.java b/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.java index d0ed3accc..dcba0eda3 100644 --- a/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.java +++ b/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.java @@ -190,11 +190,11 @@ public class DualTreeBidiMap extends AbstractDualBidiMap implements } public SortedBidiMap inverseSortedBidiMap() { - return (SortedBidiMap) inverseBidiMap(); + return inverseBidiMap(); } public OrderedBidiMap inverseOrderedBidiMap() { - return (OrderedBidiMap) inverseBidiMap(); + return inverseBidiMap(); } //----------------------------------------------------------------------- @@ -239,7 +239,7 @@ public class DualTreeBidiMap extends AbstractDualBidiMap implements // use the normalMap as the filtered map, but reverseMap as the full map // this forces containsValue and clear to be overridden super(new DualTreeBidiMap(sm, bidi.reverseMap, bidi.inverseBidiMap)); - this.bidi = (DualTreeBidiMap) decorated(); + this.bidi = decorated(); } @Override @@ -280,12 +280,12 @@ public class DualTreeBidiMap extends AbstractDualBidiMap implements @Override public K previousKey(K key) { return decorated().previousKey(key); - }; + } @Override public K nextKey(K key) { return decorated().nextKey(key); - }; + } } //----------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java b/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java index 83346db44..6381c4c28 100644 --- a/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java +++ b/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java @@ -71,7 +71,6 @@ public class BlockingBuffer extends SynchronizedBuffer { /** * Factory method to create a blocking buffer with a timeout value. * - * @param the type of the elements in the buffer * @param buffer the buffer to decorate, must not be null * @param timeoutMillis the timeout value in milliseconds, zero or less for no timeout * @return a new blocking buffer diff --git a/src/java/org/apache/commons/collections/comparators/ComparableComparator.java b/src/java/org/apache/commons/collections/comparators/ComparableComparator.java index 97a42f7ee..4ab30cd8c 100644 --- a/src/java/org/apache/commons/collections/comparators/ComparableComparator.java +++ b/src/java/org/apache/commons/collections/comparators/ComparableComparator.java @@ -46,7 +46,6 @@ public class ComparableComparator> implements Co private static final long serialVersionUID=-291439688585137865L; /** The singleton instance. */ - @SuppressWarnings("unchecked") public static final ComparableComparator INSTANCE = new ComparableComparator(); //----------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/comparators/FixedOrderComparator.java b/src/java/org/apache/commons/collections/comparators/FixedOrderComparator.java index 05fc8350f..3bd604ec4 100644 --- a/src/java/org/apache/commons/collections/comparators/FixedOrderComparator.java +++ b/src/java/org/apache/commons/collections/comparators/FixedOrderComparator.java @@ -220,7 +220,7 @@ public class FixedOrderComparator implements Comparator { * @return negative if obj1 is less, positive if greater, zero if equal * @throws IllegalArgumentException if obj1 or obj2 are not known * to this Comparator and an alternative behavior has not been set - * via {@link #setUnknownObjectBehavior(int)}. + * via {@link #setUnknownObjectBehavior(UnknownObjectBehavior)}. */ public int compare(T obj1, T obj2) { isLocked = true; diff --git a/src/java/org/apache/commons/collections/functors/ChainedClosure.java b/src/java/org/apache/commons/collections/functors/ChainedClosure.java index c5f3736f2..4d5e9286b 100644 --- a/src/java/org/apache/commons/collections/functors/ChainedClosure.java +++ b/src/java/org/apache/commons/collections/functors/ChainedClosure.java @@ -76,7 +76,7 @@ public class ChainedClosure implements Closure, Serializable { Closure[] cmds = new Closure[closures.size()]; int i = 0; for (Closure closure : closures) { - cmds[i++] = (Closure) closure; + cmds[i++] = closure; } FunctorUtils.validate(cmds); return new ChainedClosure(cmds); diff --git a/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java b/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java index ab1d0982b..82d03914a 100644 --- a/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java +++ b/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java @@ -70,8 +70,8 @@ public class InstantiateTransformer implements Transformer if (paramTypes == null || paramTypes.length == 0) { return new InstantiateTransformer(); } - paramTypes = (Class[]) paramTypes.clone(); - args = (Object[]) args.clone(); + paramTypes = paramTypes.clone(); + args = args.clone(); return new InstantiateTransformer(paramTypes, args); } diff --git a/src/java/org/apache/commons/collections/functors/InvokerTransformer.java b/src/java/org/apache/commons/collections/functors/InvokerTransformer.java index b3a2294f3..5fa6964f8 100644 --- a/src/java/org/apache/commons/collections/functors/InvokerTransformer.java +++ b/src/java/org/apache/commons/collections/functors/InvokerTransformer.java @@ -77,8 +77,8 @@ public class InvokerTransformer implements Transformer, Serializable if (paramTypes == null || paramTypes.length == 0) { return new InvokerTransformer(methodName); } else { - paramTypes = (Class[]) paramTypes.clone(); - args = (Object[]) args.clone(); + paramTypes = paramTypes.clone(); + args = args.clone(); return new InvokerTransformer(methodName, paramTypes, args); } } diff --git a/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java b/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java index a0a333f1c..8457c5b3e 100644 --- a/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java +++ b/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java @@ -74,7 +74,7 @@ public class EntrySetMapIterator implements MapIterator, ResettableI * @throws java.util.NoSuchElementException if the iteration is finished */ public K next() { - last = (Map.Entry) iterator.next(); + last = iterator.next(); canRemove = true; return last.getKey(); } diff --git a/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java b/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java index baf108545..efaf5e008 100644 --- a/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java +++ b/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java @@ -125,8 +125,7 @@ public class ListIteratorWrapper implements ResettableListIterator { */ public boolean hasPrevious() { if (iterator instanceof ListIterator) { - @SuppressWarnings("unchecked") - ListIterator li = (ListIterator) iterator; + ListIterator li = (ListIterator) iterator; return li.hasPrevious(); } return currentIndex > 0; @@ -163,8 +162,7 @@ public class ListIteratorWrapper implements ResettableListIterator { */ public int nextIndex() { if (iterator instanceof ListIterator) { - @SuppressWarnings("unchecked") - ListIterator li = (ListIterator) iterator; + ListIterator li = (ListIterator) iterator; return li.nextIndex(); } return currentIndex; @@ -197,8 +195,7 @@ public class ListIteratorWrapper implements ResettableListIterator { */ public int previousIndex() { if (iterator instanceof ListIterator) { - @SuppressWarnings("unchecked") - ListIterator li = (ListIterator) iterator; + ListIterator li = (ListIterator) iterator; return li.previousIndex(); } return currentIndex - 1; @@ -255,8 +252,7 @@ public class ListIteratorWrapper implements ResettableListIterator { */ public void reset() { if (iterator instanceof ListIterator) { - @SuppressWarnings("unchecked") - ListIterator li = (ListIterator) iterator; + ListIterator li = (ListIterator) iterator; while (li.previousIndex() >= 0) { li.previous(); } diff --git a/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java b/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java index d06d37512..930a67d06 100644 --- a/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java +++ b/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java @@ -68,7 +68,6 @@ public abstract class AbstractMapEntry extends AbstractKeyValue impl * @return true if equal key and value */ @Override - @SuppressWarnings("unchecked") public boolean equals(Object obj) { if (obj == this) { return true; @@ -76,7 +75,7 @@ public abstract class AbstractMapEntry extends AbstractKeyValue impl if (obj instanceof Map.Entry == false) { return false; } - Map.Entry other = (Map.Entry) obj; + Map.Entry other = (Map.Entry) obj; return (getKey() == null ? other.getKey() == null : getKey().equals(other.getKey())) && (getValue() == null ? other.getValue() == null : getValue().equals(other.getValue())); diff --git a/src/java/org/apache/commons/collections/keyvalue/DefaultKeyValue.java b/src/java/org/apache/commons/collections/keyvalue/DefaultKeyValue.java index b0c160813..a97ca9a98 100644 --- a/src/java/org/apache/commons/collections/keyvalue/DefaultKeyValue.java +++ b/src/java/org/apache/commons/collections/keyvalue/DefaultKeyValue.java @@ -130,7 +130,6 @@ public class DefaultKeyValue extends AbstractKeyValue { * @return true if equal key and value */ @Override - @SuppressWarnings("unchecked") public boolean equals(final Object obj) { if (obj == this) { return true; @@ -139,7 +138,7 @@ public class DefaultKeyValue extends AbstractKeyValue { return false; } - DefaultKeyValue other = (DefaultKeyValue) obj; + DefaultKeyValue other = (DefaultKeyValue) obj; return (getKey() == null ? other.getKey() == null : getKey().equals(other.getKey())) && (getValue() == null ? other.getValue() == null : getValue().equals(other.getValue())); diff --git a/src/java/org/apache/commons/collections/list/AbstractLinkedList.java b/src/java/org/apache/commons/collections/list/AbstractLinkedList.java index fd8d3d503..a0b2a8aeb 100644 --- a/src/java/org/apache/commons/collections/list/AbstractLinkedList.java +++ b/src/java/org/apache/commons/collections/list/AbstractLinkedList.java @@ -174,7 +174,7 @@ public abstract class AbstractLinkedList implements List { public T[] toArray(T[] array) { // Extend the array if needed if (array.length < size) { - Class componentType = array.getClass().getComponentType(); + Class componentType = array.getClass().getComponentType(); array = (T[]) Array.newInstance(componentType, size); } // Copy the values into the array @@ -326,7 +326,6 @@ public abstract class AbstractLinkedList implements List { //----------------------------------------------------------------------- @Override - @SuppressWarnings("unchecked") public boolean equals(Object obj) { if (obj == this) { return true; @@ -334,12 +333,12 @@ public abstract class AbstractLinkedList implements List { if (obj instanceof List == false) { return false; } - List other = (List) obj; + List other = (List) obj; if (other.size() != size()) { return false; } - ListIterator it1 = listIterator(); - ListIterator it2 = other.listIterator(); + ListIterator it1 = listIterator(); + ListIterator it2 = other.listIterator(); while (it1.hasNext() && it2.hasNext()) { Object o1 = it1.next(); Object o2 = it2.next(); diff --git a/src/java/org/apache/commons/collections/list/SetUniqueList.java b/src/java/org/apache/commons/collections/list/SetUniqueList.java index 03eda0d26..2cac90413 100644 --- a/src/java/org/apache/commons/collections/list/SetUniqueList.java +++ b/src/java/org/apache/commons/collections/list/SetUniqueList.java @@ -307,7 +307,7 @@ public class SetUniqueList extends AbstractSerializableListDecorator { subSet = new HashSet(list.size()); } else { try { - subSet = (Set) set.getClass().newInstance(); + subSet = set.getClass().newInstance(); } catch (InstantiationException ie) { subSet = new HashSet(); } catch (IllegalAccessException iae) { diff --git a/src/java/org/apache/commons/collections/map/AbstractHashedMap.java b/src/java/org/apache/commons/collections/map/AbstractHashedMap.java index d0956c13e..1fd136384 100644 --- a/src/java/org/apache/commons/collections/map/AbstractHashedMap.java +++ b/src/java/org/apache/commons/collections/map/AbstractHashedMap.java @@ -634,16 +634,16 @@ public class AbstractHashedMap extends AbstractMap implements Iterab threshold = calculateThreshold(newCapacity, loadFactor); data = new HashEntry[newCapacity]; } else { - HashEntry oldEntries[] = data; - HashEntry newEntries[] = new HashEntry[newCapacity]; + HashEntry oldEntries[] = data; + HashEntry newEntries[] = new HashEntry[newCapacity]; modCount++; for (int i = oldCapacity - 1; i >= 0; i--) { - HashEntry entry = oldEntries[i]; + HashEntry entry = oldEntries[i]; if (entry != null) { oldEntries[i] = null; // gc do { - HashEntry next = entry.next; + HashEntry next = entry.next; int index = hashIndex(entry.hashCode, newCapacity); entry.next = newEntries[index]; newEntries[index] = entry; @@ -1305,7 +1305,6 @@ public class AbstractHashedMap extends AbstractMap implements Iterab * @return true if equal */ @Override - @SuppressWarnings("unchecked") public boolean equals(Object obj) { if (obj == this) { return true; diff --git a/src/java/org/apache/commons/collections/map/AbstractReferenceMap.java b/src/java/org/apache/commons/collections/map/AbstractReferenceMap.java index 71aa9c09d..fc8996c2f 100644 --- a/src/java/org/apache/commons/collections/map/AbstractReferenceMap.java +++ b/src/java/org/apache/commons/collections/map/AbstractReferenceMap.java @@ -658,7 +658,6 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap * @return true if equal, false if not */ @Override - @SuppressWarnings("unchecked") public boolean equals(Object obj) { if (obj == this) { return true; @@ -667,7 +666,7 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap return false; } - Map.Entry entry = (Map.Entry)obj; + Map.Entry entry = (Map.Entry)obj; Object entryKey = entry.getKey(); // convert to hard reference Object entryValue = entry.getValue(); // convert to hard reference if ((entryKey == null) || (entryValue == null)) { diff --git a/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java b/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java index 4bd7fdf6c..fe908d19f 100644 --- a/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java +++ b/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java @@ -105,13 +105,13 @@ public abstract class AbstractSortedMapDecorator extends AbstractMapDecora public K previousKey(K key) { SortedMap headMap = headMap(key); return headMap.isEmpty() ? null : headMap.lastKey(); - }; + } public K nextKey(K key) { Iterator it = tailMap(key).keySet().iterator(); it.next(); return it.hasNext() ? it.next() : null; - }; + } /** * {@inheritDoc} diff --git a/src/java/org/apache/commons/collections/map/CompositeMap.java b/src/java/org/apache/commons/collections/map/CompositeMap.java index e5b5c4219..8dd13d0cc 100644 --- a/src/java/org/apache/commons/collections/map/CompositeMap.java +++ b/src/java/org/apache/commons/collections/map/CompositeMap.java @@ -464,10 +464,9 @@ public class CompositeMap extends AbstractIterableMap implements Ser * @return true if the maps are equal */ @Override - @SuppressWarnings("unchecked") public boolean equals(Object obj) { if (obj instanceof Map) { - Map map = (Map) obj; + Map map = (Map) obj; return (this.entrySet().equals(map.entrySet())); } return false; diff --git a/src/java/org/apache/commons/collections/map/DefaultedMap.java b/src/java/org/apache/commons/collections/map/DefaultedMap.java index c4a3b8766..94ff80f3a 100644 --- a/src/java/org/apache/commons/collections/map/DefaultedMap.java +++ b/src/java/org/apache/commons/collections/map/DefaultedMap.java @@ -179,7 +179,7 @@ public class DefaultedMap extends AbstractMapDecorator implements Se @SuppressWarnings("unchecked") private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); - map = (Map) in.readObject(); + map = (Map) in.readObject(); } //----------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java b/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java index d3ac26d6c..287af67c1 100644 --- a/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java +++ b/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java @@ -69,7 +69,7 @@ public class EntrySetToMapIteratorAdapter implements MapIterator, Re */ public V setValue(V value) { return current().setValue(value); - }; + } /** * {@inheritDoc} diff --git a/src/java/org/apache/commons/collections/map/Flat3Map.java b/src/java/org/apache/commons/collections/map/Flat3Map.java index 55a28b2e0..cb4f92ad5 100644 --- a/src/java/org/apache/commons/collections/map/Flat3Map.java +++ b/src/java/org/apache/commons/collections/map/Flat3Map.java @@ -1053,7 +1053,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneabl try { Flat3Map cloned = (Flat3Map) super.clone(); if (cloned.delegateMap != null) { - cloned.delegateMap = (HashedMap) cloned.delegateMap.clone(); + cloned.delegateMap = cloned.delegateMap.clone(); } return cloned; } catch (CloneNotSupportedException ex) { diff --git a/src/java/org/apache/commons/collections/map/LazyMap.java b/src/java/org/apache/commons/collections/map/LazyMap.java index 064a83733..6651f26eb 100644 --- a/src/java/org/apache/commons/collections/map/LazyMap.java +++ b/src/java/org/apache/commons/collections/map/LazyMap.java @@ -173,7 +173,7 @@ public class LazyMap extends AbstractMapDecorator implements Map) in.readObject(); } //----------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/map/MultiValueMap.java b/src/java/org/apache/commons/collections/map/MultiValueMap.java index a8b5c9bfe..2cce555a9 100644 --- a/src/java/org/apache/commons/collections/map/MultiValueMap.java +++ b/src/java/org/apache/commons/collections/map/MultiValueMap.java @@ -279,7 +279,7 @@ public class MultiValueMap extends AbstractMapDecorator impleme } } else { for (Map.Entry entry : map.entrySet()) { - put(entry.getKey(), (V) entry.getValue()); + put(entry.getKey(), entry.getValue()); } } } diff --git a/src/java/org/apache/commons/collections/map/TransformedMap.java b/src/java/org/apache/commons/collections/map/TransformedMap.java index 1159d5c88..b115c8898 100644 --- a/src/java/org/apache/commons/collections/map/TransformedMap.java +++ b/src/java/org/apache/commons/collections/map/TransformedMap.java @@ -197,7 +197,7 @@ public class TransformedMap Map result = new LinkedMap(map.size()); for (Map.Entry entry : map.entrySet()) { - result.put((K) transformKey(entry.getKey()), transformValue(entry.getValue())); + result.put(transformKey(entry.getKey()), transformValue(entry.getValue())); } return result; } diff --git a/src/java/org/apache/commons/collections/set/CompositeSet.java b/src/java/org/apache/commons/collections/set/CompositeSet.java index 5e507dfec..ca84d339c 100644 --- a/src/java/org/apache/commons/collections/set/CompositeSet.java +++ b/src/java/org/apache/commons/collections/set/CompositeSet.java @@ -164,10 +164,9 @@ public class CompositeSet extends CompositeCollection implements Set { * @see Set#equals */ @Override - @SuppressWarnings("unchecked") public boolean equals(Object obj) { if (obj instanceof Set) { - Set set = (Set) obj; + Set set = (Set) obj; return set.containsAll(this) && set.size() == this.size(); } return false; diff --git a/src/java/org/apache/commons/collections/splitmap/TransformedMap.java b/src/java/org/apache/commons/collections/splitmap/TransformedMap.java index 67a515f29..8b5cf2562 100644 --- a/src/java/org/apache/commons/collections/splitmap/TransformedMap.java +++ b/src/java/org/apache/commons/collections/splitmap/TransformedMap.java @@ -184,7 +184,7 @@ public class TransformedMap extends AbstractIterableGetMapDecorator< Map result = new LinkedMap(map.size()); for (Map.Entry entry : map.entrySet()) { - result.put((K) transformKey(entry.getKey()), transformValue(entry.getValue())); + result.put(transformKey(entry.getKey()), transformValue(entry.getValue())); } return result; }