commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r825140 - /commons/proper/collections/trunk/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java
Date Wed, 14 Oct 2009 14:04:46 GMT
Author: mbenson
Date: Wed Oct 14 14:04:46 2009
New Revision: 825140

URL: http://svn.apache.org/viewvc?rev=825140&view=rev
Log:
avoid some generic array classcastexceptions

Modified:
    commons/proper/collections/trunk/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java

Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java?rev=825140&r1=825139&r2=825140&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java
(original)
+++ commons/proper/collections/trunk/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java
Wed Oct 14 14:04:46 2009
@@ -46,9 +46,13 @@
     protected List<V> sortedValues = new ArrayList<V>();
     protected SortedSet<V> sortedNewValues = new TreeSet<V>();
 
+    @SuppressWarnings("unchecked")
     public AbstractTestSortedBidiMap(String testName) {
         super(testName);
-        sortedKeys.addAll(Arrays.asList(getSampleKeys()));
+        Object[] sampleKeys = getSampleKeys();
+        for (Object key : sampleKeys) {
+            sortedKeys.add((K) key);
+        }
         Collections.sort(sortedKeys);
         sortedKeys = Collections.unmodifiableList(sortedKeys);
 
@@ -58,7 +62,10 @@
         sortedValues.addAll(map.values());
         sortedValues = Collections.unmodifiableList(sortedValues);
 
-        sortedNewValues.addAll(Arrays.asList(getNewSampleValues()));
+        Object[] newSampleValues = getNewSampleValues();
+        for (Object value : newSampleValues) {
+            sortedNewValues.add((V) value);
+        }
     }
 
 //    public AbstractTestSortedBidiMap() {



Mime
View raw message