From d1eecac1f669da8282f3f36219ecb8ecc8522ce0 Mon Sep 17 00:00:00 2001 From: Matthew Jason Benson Date: Wed, 14 Oct 2009 14:04:46 +0000 Subject: [PATCH] avoid some generic array classcastexceptions git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@825140 13f79535-47bb-0310-9956-ffa450edef68 --- .../bidimap/AbstractTestSortedBidiMap.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java b/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java index 8d1a85709..da9845b6f 100644 --- a/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java +++ b/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java @@ -46,9 +46,13 @@ public abstract class AbstractTestSortedBidiMap, V exten protected List sortedValues = new ArrayList(); protected SortedSet sortedNewValues = new TreeSet(); + @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 @@ public abstract class AbstractTestSortedBidiMap, V exten 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() {