commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r966368 - in /commons/proper/collections/trunk/src/java/org/apache/commons/collections: ./ bag/ bidimap/ buffer/ comparators/ functors/ iterators/ keyvalue/ list/ map/ set/ splitmap/
Date Wed, 21 Jul 2010 19:07:54 GMT
Author: sebb
Date: Wed Jul 21 19:07:52 2010
New Revision: 966368

URL: http://svn.apache.org/viewvc?rev=966368&view=rev
Log:
Fix up generics and other warnings

Modified:
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/CollectionUtils.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/IteratorUtils.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/AbstractMapBag.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/comparators/ComparableComparator.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/comparators/FixedOrderComparator.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/ChainedClosure.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/keyvalue/DefaultKeyValue.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/AbstractLinkedList.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/SetUniqueList.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractReferenceMap.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/CompositeMap.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/DefaultedMap.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LazyMap.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/MultiValueMap.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/TransformedMap.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/CompositeSet.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/splitmap/TransformedMap.java

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/CollectionUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/CollectionUtils.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/CollectionUtils.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/CollectionUtils.java
Wed Jul 21 19:07:52 2010
@@ -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<Object>());
 
     /**

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/IteratorUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/IteratorUtils.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/IteratorUtils.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/IteratorUtils.java
Wed Jul 21 19:07:52 2010
@@ -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>((Object[]) obj);
         }
         if (obj instanceof Enumeration) {
-            return new EnumerationIterator((Enumeration) obj);
+            return new EnumerationIterator<Object>((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<Object>(((Dictionary<?, ?>) obj).elements());
         } else if (obj.getClass().isArray()) {
-            return new ArrayIterator(obj);
+            return new ArrayIterator<Object>(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;
                 }

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/AbstractMapBag.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/AbstractMapBag.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/AbstractMapBag.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/AbstractMapBag.java
Wed Jul 21 19:07:52 2010
@@ -138,12 +138,11 @@ public abstract class AbstractMapBag<E> 
      * @param coll the collection to check against
      * @return <code>true</code> 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<Object>((Collection<Object>) coll));
+        return containsAll(new HashBag<Object>(coll));
     }
 
     /**
@@ -208,7 +207,7 @@ public abstract class AbstractMapBag<E> 
                 throw new ConcurrentModificationException();
             }
             if (itemCount == 0) {
-                current = (Map.Entry<E, MutableInteger>) entryIterator.next();
+                current = entryIterator.next();
                 itemCount = current.getValue().value;
             }
             canRemove = true;
@@ -365,12 +364,11 @@ public abstract class AbstractMapBag<E> 
      * @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<Object>((Collection<Object>) coll));
+        return retainAll(new HashBag<Object>(coll));
     }
 
     /**

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.java
Wed Jul 21 19:07:52 2010
@@ -190,11 +190,11 @@ public class DualTreeBidiMap<K, V> exten
     }
 
     public SortedBidiMap<V, K> inverseSortedBidiMap() {
-        return (SortedBidiMap<V, K>) inverseBidiMap();
+        return inverseBidiMap();
     }
 
     public OrderedBidiMap<V, K> inverseOrderedBidiMap() {
-        return (OrderedBidiMap<V, K>) inverseBidiMap();
+        return inverseBidiMap();
     }
 
     //-----------------------------------------------------------------------
@@ -239,7 +239,7 @@ public class DualTreeBidiMap<K, V> exten
             // use the normalMap as the filtered map, but reverseMap as the full map
             // this forces containsValue and clear to be overridden
             super(new DualTreeBidiMap<K, V>(sm, bidi.reverseMap, bidi.inverseBidiMap));
-            this.bidi = (DualTreeBidiMap<K, V>) decorated();
+            this.bidi = decorated();
         }
 
         @Override
@@ -280,12 +280,12 @@ public class DualTreeBidiMap<K, V> exten
         @Override
         public K previousKey(K key) {
             return decorated().previousKey(key);
-        };
+        }
 
         @Override
         public K nextKey(K key) {
             return decorated().nextKey(key);
-        };
+        }
     }
 
     //-----------------------------------------------------------------------

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java
Wed Jul 21 19:07:52 2010
@@ -71,7 +71,6 @@ public class BlockingBuffer<E> extends S
     /**
      * Factory method to create a blocking buffer with a timeout value.
      *
-     * @param <t> 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

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/comparators/ComparableComparator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/comparators/ComparableComparator.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/comparators/ComparableComparator.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/comparators/ComparableComparator.java
Wed Jul 21 19:07:52 2010
@@ -46,7 +46,6 @@ public class ComparableComparator<E exte
     private static final long serialVersionUID=-291439688585137865L;
 
     /** The singleton instance. */
-    @SuppressWarnings("unchecked")
     public static final ComparableComparator<?> INSTANCE = new ComparableComparator();
 
     //-----------------------------------------------------------------------

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/comparators/FixedOrderComparator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/comparators/FixedOrderComparator.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/comparators/FixedOrderComparator.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/comparators/FixedOrderComparator.java
Wed Jul 21 19:07:52 2010
@@ -220,7 +220,7 @@ public class FixedOrderComparator<T> imp
      * @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;

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/ChainedClosure.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/ChainedClosure.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/ChainedClosure.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/ChainedClosure.java
Wed Jul 21 19:07:52 2010
@@ -76,7 +76,7 @@ public class ChainedClosure<E> implement
         Closure<? super E>[] cmds = new Closure[closures.size()];
         int i = 0;
         for (Closure<? super E> closure : closures) {
-            cmds[i++] = (Closure<E>) closure;
+            cmds[i++] = closure;
         }
         FunctorUtils.validate(cmds);
         return new ChainedClosure<E>(cmds);

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java
Wed Jul 21 19:07:52 2010
@@ -70,8 +70,8 @@ public class InstantiateTransformer<T> i
         if (paramTypes == null || paramTypes.length == 0) {
             return new InstantiateTransformer<T>();
         }
-        paramTypes = (Class[]) paramTypes.clone();
-        args = (Object[]) args.clone();
+        paramTypes = paramTypes.clone();
+        args = args.clone();
         return new InstantiateTransformer<T>(paramTypes, args);
     }
 

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/InvokerTransformer.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
Wed Jul 21 19:07:52 2010
@@ -77,8 +77,8 @@ public class InvokerTransformer<I, O> im
         if (paramTypes == null || paramTypes.length == 0) {
             return new InvokerTransformer<I, O>(methodName);
         } else {
-            paramTypes = (Class[]) paramTypes.clone();
-            args = (Object[]) args.clone();
+            paramTypes = paramTypes.clone();
+            args = args.clone();
             return new InvokerTransformer<I, O>(methodName, paramTypes, args);
         }
     }

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java
Wed Jul 21 19:07:52 2010
@@ -74,7 +74,7 @@ public class EntrySetMapIterator<K, V> i
      * @throws java.util.NoSuchElementException if the iteration is finished
      */
     public K next() {
-        last = (Map.Entry<K, V>) iterator.next();
+        last = iterator.next();
         canRemove = true;
         return last.getKey();
     }

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java
Wed Jul 21 19:07:52 2010
@@ -125,8 +125,7 @@ public class ListIteratorWrapper<E> impl
      */
     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<E> impl
      */
     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<E> impl
      */
     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<E> impl
      */
     public void reset()  {
         if (iterator instanceof ListIterator) {
-            @SuppressWarnings("unchecked")
-            ListIterator li = (ListIterator) iterator;
+            ListIterator<?> li = (ListIterator<?>) iterator;
             while (li.previousIndex() >= 0) {
                 li.previous();
             }

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java
Wed Jul 21 19:07:52 2010
@@ -68,7 +68,6 @@ public abstract class AbstractMapEntry<K
      * @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<K
         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()));

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/keyvalue/DefaultKeyValue.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/keyvalue/DefaultKeyValue.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/keyvalue/DefaultKeyValue.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/keyvalue/DefaultKeyValue.java
Wed Jul 21 19:07:52 2010
@@ -130,7 +130,6 @@ public class DefaultKeyValue<K, V> exten
      * @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<K, V> exten
             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()));

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/AbstractLinkedList.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/AbstractLinkedList.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/AbstractLinkedList.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/AbstractLinkedList.java
Wed Jul 21 19:07:52 2010
@@ -174,7 +174,7 @@ public abstract class AbstractLinkedList
     public <T> 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
 
     //-----------------------------------------------------------------------
     @Override
-    @SuppressWarnings("unchecked")
     public boolean equals(Object obj) {
         if (obj == this) {
             return true;
@@ -334,12 +333,12 @@ public abstract class AbstractLinkedList
         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();

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/SetUniqueList.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/SetUniqueList.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/SetUniqueList.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/SetUniqueList.java
Wed Jul 21 19:07:52 2010
@@ -307,7 +307,7 @@ public class SetUniqueList<E> extends Ab
             subSet = new HashSet<E>(list.size());
         } else {
             try {
-                subSet = (Set<E>) set.getClass().newInstance();
+                subSet = set.getClass().newInstance();
             } catch (InstantiationException ie) {
                 subSet = new HashSet<E>();
             } catch (IllegalAccessException iae) {

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java
Wed Jul 21 19:07:52 2010
@@ -634,16 +634,16 @@ public class AbstractHashedMap<K, V> ext
             threshold = calculateThreshold(newCapacity, loadFactor);
             data = new HashEntry[newCapacity];
         } else {
-            HashEntry oldEntries[] = data;
-            HashEntry newEntries[] = new HashEntry[newCapacity];
+            HashEntry<K, V> oldEntries[] = data;
+            HashEntry<K, V> newEntries[] = new HashEntry[newCapacity];
 
             modCount++;
             for (int i = oldCapacity - 1; i >= 0; i--) {
-                HashEntry entry = oldEntries[i];
+                HashEntry<K, V> entry = oldEntries[i];
                 if (entry != null) {
                     oldEntries[i] = null;  // gc
                     do {
-                        HashEntry next = entry.next;
+                        HashEntry<K, V> next = entry.next;
                         int index = hashIndex(entry.hashCode, newCapacity);
                         entry.next = newEntries[index];
                         newEntries[index] = entry;
@@ -1305,7 +1305,6 @@ public class AbstractHashedMap<K, V> ext
      * @return true if equal
      */
     @Override
-    @SuppressWarnings("unchecked")
     public boolean equals(Object obj) {
         if (obj == this) {
             return true;

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractReferenceMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractReferenceMap.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractReferenceMap.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractReferenceMap.java
Wed Jul 21 19:07:52 2010
@@ -658,7 +658,6 @@ public abstract class AbstractReferenceM
          * @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 AbstractReferenceM
                 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)) {

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java
Wed Jul 21 19:07:52 2010
@@ -105,13 +105,13 @@ public abstract class AbstractSortedMapD
     public K previousKey(K key) {
         SortedMap<K, V> headMap = headMap(key);
         return headMap.isEmpty() ? null : headMap.lastKey();
-    };
+    }
 
     public K nextKey(K key) {
         Iterator<K> it = tailMap(key).keySet().iterator();
         it.next();
         return it.hasNext() ? it.next() : null;
-    };
+    }
 
     /**
      * {@inheritDoc}

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/CompositeMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/CompositeMap.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/CompositeMap.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/CompositeMap.java
Wed Jul 21 19:07:52 2010
@@ -464,10 +464,9 @@ public class CompositeMap<K, V> extends 
      * @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;

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/DefaultedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/DefaultedMap.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/DefaultedMap.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/DefaultedMap.java
Wed Jul 21 19:07:52 2010
@@ -179,7 +179,7 @@ public class DefaultedMap<K, V> extends 
     @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
         in.defaultReadObject();
-        map = (Map) in.readObject();
+        map = (Map<K, V>) in.readObject();
     }
 
     //-----------------------------------------------------------------------

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java
Wed Jul 21 19:07:52 2010
@@ -69,7 +69,7 @@ public class EntrySetToMapIteratorAdapte
      */
     public V setValue(V value) {
         return current().setValue(value);
-    };
+    }
 
     /**
      * {@inheritDoc}

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java
Wed Jul 21 19:07:52 2010
@@ -1053,7 +1053,7 @@ public class Flat3Map<K, V> implements I
         try {
             Flat3Map<K, V> cloned = (Flat3Map<K, V>) super.clone();
             if (cloned.delegateMap != null) {
-                cloned.delegateMap = (HashedMap<K, V>) cloned.delegateMap.clone();
+                cloned.delegateMap = cloned.delegateMap.clone();
             }
             return cloned;
         } catch (CloneNotSupportedException ex) {

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LazyMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LazyMap.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LazyMap.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LazyMap.java
Wed Jul 21 19:07:52 2010
@@ -173,7 +173,7 @@ public class LazyMap<K, V> extends Abstr
     @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
         in.defaultReadObject();
-        map = (Map) in.readObject();
+        map = (Map<K, V>) in.readObject();
     }
 
     //-----------------------------------------------------------------------

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/MultiValueMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/MultiValueMap.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/MultiValueMap.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/MultiValueMap.java
Wed Jul 21 19:07:52 2010
@@ -279,7 +279,7 @@ public class MultiValueMap<K, V> extends
             }
         } else {
             for (Map.Entry<? extends K, ?> entry : map.entrySet()) {
-                put(entry.getKey(), (V) entry.getValue());
+                put(entry.getKey(), entry.getValue());
             }
         }
     }

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/TransformedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/TransformedMap.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/TransformedMap.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/TransformedMap.java
Wed Jul 21 19:07:52 2010
@@ -197,7 +197,7 @@ public class TransformedMap<K, V>
         Map<K, V> result = new LinkedMap<K, V>(map.size());
 
         for (Map.Entry<? extends K, ? extends V> entry : map.entrySet()) {
-            result.put((K) transformKey(entry.getKey()), transformValue(entry.getValue()));
+            result.put(transformKey(entry.getKey()), transformValue(entry.getValue()));
         }
         return result;
     }

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/CompositeSet.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/CompositeSet.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/CompositeSet.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/CompositeSet.java
Wed Jul 21 19:07:52 2010
@@ -164,10 +164,9 @@ public class CompositeSet<E> extends Com
      * @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;

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/splitmap/TransformedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/splitmap/TransformedMap.java?rev=966368&r1=966367&r2=966368&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/splitmap/TransformedMap.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/splitmap/TransformedMap.java
Wed Jul 21 19:07:52 2010
@@ -184,7 +184,7 @@ public class TransformedMap<J, K, U, V> 
         Map<K, V> result = new LinkedMap<K, V>(map.size());
 
         for (Map.Entry<? extends J, ? extends U> entry : map.entrySet()) {
-            result.put((K) transformKey(entry.getKey()), transformValue(entry.getValue()));
+            result.put(transformKey(entry.getKey()), transformValue(entry.getValue()));
         }
         return result;
     }



Mime
View raw message