From fb3daab4fdded1c8dd1a4c645e5c864fb61f4d25 Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Wed, 21 Jul 2010 19:06:17 +0000 Subject: [PATCH] Fix up generics and other warnings git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@966367 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/commons/collections/BulkTest.java | 2 +- .../commons/collections/LocalTestNode.java | 3 +- .../commons/collections/TestListUtils.java | 6 ++-- .../collections/bag/AbstractTestBag.java | 10 +++--- .../bag/TestTransformedSortedBag.java | 4 +-- .../bidimap/AbstractTestSortedBidiMap.java | 1 - .../bidimap/TestDualTreeBidiMap2.java | 4 +-- .../collections/list/AbstractTestList.java | 14 ++++---- .../collections/map/AbstractTestMap.java | 12 +++---- .../map/TestCaseInsensitiveMap.java | 2 +- .../commons/collections/map/TestFlat3Map.java | 9 +++-- .../collections/map/TestIdentityMap.java | 4 +-- .../commons/collections/map/TestLRUMap.java | 28 +++++++-------- .../collections/map/TestMultiKeyMap.java | 34 +++++++++---------- .../collections/map/TestTransformedMap.java | 2 +- .../map/TestTransformedSortedMap.java | 2 +- .../set/AbstractTestSortedSet.java | 2 +- .../collections/set/EmptySetMutator.java | 4 +-- .../collections/set/TestCompositeSet.java | 2 +- .../collections/set/TestTransformedSet.java | 4 +-- .../set/TestTransformedSortedSet.java | 4 +-- .../splitmap/TestTransformedMap.java | 5 ++- 22 files changed, 75 insertions(+), 83 deletions(-) diff --git a/src/test/org/apache/commons/collections/BulkTest.java b/src/test/org/apache/commons/collections/BulkTest.java index 931c8b1cb..bd7d61b03 100644 --- a/src/test/org/apache/commons/collections/BulkTest.java +++ b/src/test/org/apache/commons/collections/BulkTest.java @@ -415,7 +415,7 @@ class BulkTestSuiteMaker { private static BulkTest makeTestCase(Class c, Method m) { Constructor con = getTestCaseConstructor(c); try { - return (BulkTest) con.newInstance(new Object[] { m.getName() }); + return con.newInstance(new Object[] { m.getName() }); } catch (InvocationTargetException e) { e.printStackTrace(); throw new RuntimeException(); // FIXME; diff --git a/src/test/org/apache/commons/collections/LocalTestNode.java b/src/test/org/apache/commons/collections/LocalTestNode.java index d4f8ca9f8..45d3835dd 100644 --- a/src/test/org/apache/commons/collections/LocalTestNode.java +++ b/src/test/org/apache/commons/collections/LocalTestNode.java @@ -73,7 +73,7 @@ class LocalTestNode, V extends Comparable> implements /** * Method compareTo * - * @param o + * @param other * * @return a negative integer, zero, or a positive integer * as this object is less than, equal to, or greater than the specified object. @@ -97,7 +97,6 @@ class LocalTestNode, V extends Comparable> implements * @return true if equal */ @Override - @SuppressWarnings("unchecked") public boolean equals(Object o) { if (o == null) { diff --git a/src/test/org/apache/commons/collections/TestListUtils.java b/src/test/org/apache/commons/collections/TestListUtils.java index e4c370eb1..67883a790 100644 --- a/src/test/org/apache/commons/collections/TestListUtils.java +++ b/src/test/org/apache/commons/collections/TestListUtils.java @@ -115,8 +115,8 @@ public class TestListUtils extends BulkTest { * Tests intersecting two lists in different orders. */ public void testIntersectionOrderInsensitivity() { - List one = new ArrayList(); - List two = new ArrayList(); + List one = new ArrayList(); + List two = new ArrayList(); one.add("a"); one.add("b"); two.add("a"); @@ -237,7 +237,7 @@ public class TestListUtils extends BulkTest { */ // TODO: Generics public void testIndexOf() { - Predicate testPredicate = PredicateUtils.equalPredicate("d"); + Predicate testPredicate = PredicateUtils.equalPredicate("d"); int index = ListUtils.indexOf(fullList, testPredicate); assertEquals(d, fullList.get(index)); diff --git a/src/test/org/apache/commons/collections/bag/AbstractTestBag.java b/src/test/org/apache/commons/collections/bag/AbstractTestBag.java index 606bc2b31..3d062527a 100644 --- a/src/test/org/apache/commons/collections/bag/AbstractTestBag.java +++ b/src/test/org/apache/commons/collections/bag/AbstractTestBag.java @@ -374,7 +374,7 @@ public abstract class AbstractTestBag extends AbstractTestObject { bag.add((T) "B"); bag.add((T) "B"); bag.add((T) "C"); - String[] array = (String[]) bag.toArray(new String[0]); + String[] array = bag.toArray(new String[0]); int a = 0, b = 0, c = 0; for (int i = 0; i < array.length; i++) { a += (array[i].equals("A") ? 1 : 0); @@ -455,13 +455,12 @@ public abstract class AbstractTestBag extends AbstractTestObject { } //----------------------------------------------------------------------- - @SuppressWarnings("unchecked") public void testEmptyBagSerialization() throws IOException, ClassNotFoundException { Bag bag = makeObject(); if (!(bag instanceof Serializable && isTestSerialization())) return; byte[] objekt = writeExternalFormToBytes((Serializable) bag); - Bag bag2 = (Bag) readExternalFormFromBytes(objekt); + Bag bag2 = (Bag) readExternalFormFromBytes(objekt); assertEquals("Bag should be empty",0, bag.size()); assertEquals("Bag should be empty",0, bag2.size()); @@ -479,7 +478,7 @@ public abstract class AbstractTestBag extends AbstractTestObject { if (!(bag instanceof Serializable && isTestSerialization())) return; byte[] objekt = writeExternalFormToBytes((Serializable) bag); - Bag bag2 = (Bag) readExternalFormFromBytes(objekt); + Bag bag2 = (Bag) readExternalFormFromBytes(objekt); assertEquals("Bag should be same size", size, bag.size()); assertEquals("Bag should be same size", size, bag2.size()); @@ -501,12 +500,11 @@ public abstract class AbstractTestBag extends AbstractTestObject { * Compare the current serialized form of the Bag * against the canonical version in SVN. */ - @SuppressWarnings("unchecked") public void testEmptyBagCompatibility() throws IOException, ClassNotFoundException { // test to make sure the canonical form has been preserved Bag bag = makeObject(); if (bag instanceof Serializable && !skipSerializedCanonicalTests() && isTestSerialization()) { - Bag bag2 = (Bag) readExternalFormFromDisk(getCanonicalEmptyCollectionName(bag)); + Bag bag2 = (Bag) readExternalFormFromDisk(getCanonicalEmptyCollectionName(bag)); assertTrue("Bag is empty",bag2.size() == 0); assertEquals(bag, bag2); } diff --git a/src/test/org/apache/commons/collections/bag/TestTransformedSortedBag.java b/src/test/org/apache/commons/collections/bag/TestTransformedSortedBag.java index 00357b9e0..4a911d6c0 100644 --- a/src/test/org/apache/commons/collections/bag/TestTransformedSortedBag.java +++ b/src/test/org/apache/commons/collections/bag/TestTransformedSortedBag.java @@ -70,12 +70,12 @@ public class TestTransformedSortedBag extends AbstractTestSortedBag { } public void testTransformedBag_decorateTransform() { - Bag originalBag = new TreeBag(); + Bag originalBag = new TreeBag(); Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"}; for (int i = 0; i < els.length; i++) { originalBag.add(els[i]); } - Bag bag = TransformedBag.decorateTransform(originalBag, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); + Bag bag = TransformedBag.decorateTransform(originalBag, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); assertEquals(els.length, bag.size()); for (int i = 0; i < els.length; i++) { assertEquals(true, bag.contains(new Integer((String) els[i]))); diff --git a/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java b/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java index f6536ad92..db7df23c0 100644 --- a/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java +++ b/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java @@ -17,7 +17,6 @@ package org.apache.commons.collections.bidimap; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; diff --git a/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java b/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java index c60a4984e..b957b966f 100644 --- a/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java +++ b/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java @@ -21,7 +21,6 @@ import java.io.ByteArrayOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; -import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -77,9 +76,8 @@ public class TestDualTreeBidiMap2, V extends Comparable< assertTrue(bidi.comparator() instanceof ReverseComparator); } - @SuppressWarnings("unchecked") public void testSerializeDeserializeCheckComparator() throws Exception { - SortedBidiMap obj = (SortedBidiMap) makeObject(); + SortedBidiMap obj = makeObject(); if (obj instanceof Serializable && isTestSerialization()) { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(buffer); diff --git a/src/test/org/apache/commons/collections/list/AbstractTestList.java b/src/test/org/apache/commons/collections/list/AbstractTestList.java index 301f5ec2c..5c5316a7f 100644 --- a/src/test/org/apache/commons/collections/list/AbstractTestList.java +++ b/src/test/org/apache/commons/collections/list/AbstractTestList.java @@ -283,8 +283,8 @@ public abstract class AbstractTestList extends AbstractTestCollection { for (int i = 0; i <= max; i++) { resetFull(); - ((List) getCollection()).add(i, element); - ((List) getConfirmed()).add(i, element); + getCollection().add(i, element); + getConfirmed().add(i, element); verify(); } } @@ -621,9 +621,9 @@ public abstract class AbstractTestList extends AbstractTestCollection { for (int i = 0; i < elements.length; i++) { E n = other[i % other.length]; - E v = ((List) getCollection()).set(i, n); + E v = (getCollection()).set(i, n); assertEquals("Set should return correct element", elements[i], v); - ((List) getConfirmed()).set(i, n); + (getConfirmed()).set(i, n); verify(); } } @@ -637,7 +637,7 @@ public abstract class AbstractTestList extends AbstractTestCollection { resetFull(); try { - ((List) getCollection()).set(0, getFullElements()[0]); + (getCollection()).set(0, getFullElements()[0]); fail("Emtpy collection should not support set."); } catch (UnsupportedOperationException e) { // expected @@ -742,8 +742,8 @@ public abstract class AbstractTestList extends AbstractTestCollection { int max = getFullElements().length; for (int i = 0; i < max; i++) { resetFull(); - E o1 = ((List) getCollection()).remove(i); - E o2 = ((List) getConfirmed()).remove(i); + E o1 = (getCollection()).remove(i); + E o2 = (getConfirmed()).remove(i); assertEquals("remove should return correct element", o1, o2); verify(); } diff --git a/src/test/org/apache/commons/collections/map/AbstractTestMap.java b/src/test/org/apache/commons/collections/map/AbstractTestMap.java index c48d30ef9..8e92d017b 100644 --- a/src/test/org/apache/commons/collections/map/AbstractTestMap.java +++ b/src/test/org/apache/commons/collections/map/AbstractTestMap.java @@ -745,7 +745,6 @@ public abstract class AbstractTestMap extends AbstractTestObject { * Compare the current serialized form of the Map * against the canonical version in SVN. */ - @SuppressWarnings("unchecked") public void testEmptyMapCompatibility() throws Exception { /** * Create canonical objects with this code @@ -756,9 +755,10 @@ public abstract class AbstractTestMap extends AbstractTestObject { */ // test to make sure the canonical form has been preserved - Map map = makeObject(); + Map map = makeObject(); if (map instanceof Serializable && !skipSerializedCanonicalTests() && isTestSerialization()) { - Map map2 = (Map) readExternalFormFromDisk(getCanonicalEmptyCollectionName(map)); + @SuppressWarnings("unchecked") + Map map2 = (Map) readExternalFormFromDisk(getCanonicalEmptyCollectionName(map)); assertEquals("Map is empty", 0, map2.size()); } } @@ -767,7 +767,6 @@ public abstract class AbstractTestMap extends AbstractTestObject { * Compare the current serialized form of the Map * against the canonical version in SVN. */ - @SuppressWarnings("unchecked") public void testFullMapCompatibility() throws Exception { /** * Create canonical objects with this code @@ -778,9 +777,10 @@ public abstract class AbstractTestMap extends AbstractTestObject { */ // test to make sure the canonical form has been preserved - Map map = makeFullMap(); + Map map = makeFullMap(); if (map instanceof Serializable && !skipSerializedCanonicalTests() && isTestSerialization()) { - Map map2 = (Map) readExternalFormFromDisk(getCanonicalFullCollectionName(map)); + @SuppressWarnings("unchecked") + Map map2 = (Map) readExternalFormFromDisk(getCanonicalFullCollectionName(map)); assertEquals("Map is the right size", getSampleKeys().length, map2.size()); } } diff --git a/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java b/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java index 445ea8737..53abb69bb 100644 --- a/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java +++ b/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java @@ -142,7 +142,7 @@ public class TestCaseInsensitiveMap extends AbstractTestIterableMap Locale.setDefault(locales[i]); for (int j = 0; j < data.length; j++) { assertTrue("Test data corrupt: " + j, data[j][0].equalsIgnoreCase(data[j][1])); - CaseInsensitiveMap map = new CaseInsensitiveMap(); + CaseInsensitiveMap map = new CaseInsensitiveMap(); map.put(data[j][0], "value"); assertEquals(Locale.getDefault() + ": " + j, "value", map.get(data[j][1])); } diff --git a/src/test/org/apache/commons/collections/map/TestFlat3Map.java b/src/test/org/apache/commons/collections/map/TestFlat3Map.java index 91b7b632a..d0eec9290 100644 --- a/src/test/org/apache/commons/collections/map/TestFlat3Map.java +++ b/src/test/org/apache/commons/collections/map/TestFlat3Map.java @@ -154,7 +154,6 @@ public class TestFlat3Map extends AbstractTestIterableMap { assertSame(TWO, cloned.get(TWENTY)); } - @SuppressWarnings("unchecked") public void testSerialisation0() throws Exception { Flat3Map map = makeObject(); ByteArrayOutputStream bout = new ByteArrayOutputStream(); @@ -164,7 +163,7 @@ public class TestFlat3Map extends AbstractTestIterableMap { out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bytes); ObjectInputStream in = new ObjectInputStream(bin); - Flat3Map ser = (Flat3Map) in.readObject(); + Flat3Map ser = (Flat3Map) in.readObject(); in.close(); assertEquals(0, map.size()); assertEquals(0, ser.size()); @@ -183,7 +182,7 @@ public class TestFlat3Map extends AbstractTestIterableMap { out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bytes); ObjectInputStream in = new ObjectInputStream(bin); - Flat3Map ser = (Flat3Map) in.readObject(); + Flat3Map ser = (Flat3Map) in.readObject(); in.close(); assertEquals(2, map.size()); assertEquals(2, ser.size()); @@ -208,7 +207,7 @@ public class TestFlat3Map extends AbstractTestIterableMap { out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bytes); ObjectInputStream in = new ObjectInputStream(bin); - Flat3Map ser = (Flat3Map) in.readObject(); + Flat3Map ser = (Flat3Map) in.readObject(); in.close(); assertEquals(4, map.size()); assertEquals(4, ser.size()); @@ -418,7 +417,7 @@ public class TestFlat3Map extends AbstractTestIterableMap { // } public void testCollections261() { - Flat3Map m = new Flat3Map(); + Flat3Map m = new Flat3Map(); m.put( new Integer(1), new Integer(1) ); m.put( new Integer(0), new Integer(0) ); assertEquals( new Integer(1), m.remove( new Integer(1) ) ); diff --git a/src/test/org/apache/commons/collections/map/TestIdentityMap.java b/src/test/org/apache/commons/collections/map/TestIdentityMap.java index 6213d63ef..d9f564850 100644 --- a/src/test/org/apache/commons/collections/map/TestIdentityMap.java +++ b/src/test/org/apache/commons/collections/map/TestIdentityMap.java @@ -121,12 +121,12 @@ public class TestIdentityMap extends AbstractTestObject { * Compare the current serialized form of the Map * against the canonical version in SVN. */ - @SuppressWarnings("unchecked") public void testEmptyMapCompatibility() throws IOException, ClassNotFoundException { // test to make sure the canonical form has been preserved Map map = makeObject(); if (map instanceof Serializable && !skipSerializedCanonicalTests()) { - Map map2 = (Map) readExternalFormFromDisk(getCanonicalEmptyCollectionName(map)); + @SuppressWarnings("unchecked") + Map map2 = (Map) readExternalFormFromDisk(getCanonicalEmptyCollectionName(map)); assertEquals("Map is empty", 0, map2.size()); } } diff --git a/src/test/org/apache/commons/collections/map/TestLRUMap.java b/src/test/org/apache/commons/collections/map/TestLRUMap.java index 83d971a0a..b14b8689a 100644 --- a/src/test/org/apache/commons/collections/map/TestLRUMap.java +++ b/src/test/org/apache/commons/collections/map/TestLRUMap.java @@ -238,7 +238,7 @@ public class TestLRUMap extends AbstractTestOrderedMap { @SuppressWarnings("unchecked") public void testRemoveLRU() { - MockLRUMapSubclass map = new MockLRUMapSubclass(2); + MockLRUMapSubclass map = new MockLRUMapSubclass(2); assertNull(map.entry); map.put((K) "A", "a"); assertNull(map.entry); @@ -484,9 +484,9 @@ public class TestLRUMap extends AbstractTestOrderedMap { // TODO: COLLECTIONS-330 public void todoTestSynchronizedRemoveFromMapIterator() throws InterruptedException { - final LRUMap map = new LRUMap(10000); + final LRUMap map = new LRUMap(10000); - final Map exceptions = new HashMap(); + final Map exceptions = new HashMap(); final ThreadGroup tg = new ThreadGroup(getName()) { @Override public void uncaughtException(Thread t, Throwable e) { @@ -516,7 +516,7 @@ public class TestLRUMap extends AbstractTestOrderedMap { } } synchronized (map) { - for (MapIterator iter = map.mapIterator(); iter.hasNext();) { + for (MapIterator iter = map.mapIterator(); iter.hasNext();) { String name = (String)iter.next(); if (map.get(name) == this) { iter.remove(); @@ -567,9 +567,9 @@ public class TestLRUMap extends AbstractTestOrderedMap { public void testSynchronizedRemoveFromEntrySet() throws InterruptedException { - final Map map = new LRUMap(10000); + final Map map = new LRUMap(10000); - final Map exceptions = new HashMap(); + final Map exceptions = new HashMap(); final ThreadGroup tg = new ThreadGroup(getName()) { @Override public void uncaughtException(Thread t, Throwable e) { @@ -599,8 +599,8 @@ public class TestLRUMap extends AbstractTestOrderedMap { } } synchronized (map) { - for (Iterator iter = map.entrySet().iterator(); iter.hasNext();) { - Map.Entry entry = (Map.Entry)iter.next(); + for (Iterator> iter = map.entrySet().iterator(); iter.hasNext();) { + Map.Entry entry = iter.next(); if (entry.getValue() == this) { iter.remove(); } @@ -651,9 +651,9 @@ public class TestLRUMap extends AbstractTestOrderedMap { // TODO: COLLECTIONS-330 public void todoTestSynchronizedRemoveFromKeySet() throws InterruptedException { - final Map map = new LRUMap(10000); + final Map map = new LRUMap(10000); - final Map exceptions = new HashMap(); + final Map exceptions = new HashMap(); final ThreadGroup tg = new ThreadGroup(getName()) { @Override public void uncaughtException(Thread t, Throwable e) { @@ -683,7 +683,7 @@ public class TestLRUMap extends AbstractTestOrderedMap { } } synchronized (map) { - for (Iterator iter = map.keySet().iterator(); iter.hasNext();) { + for (Iterator iter = map.keySet().iterator(); iter.hasNext();) { String name = (String)iter.next(); if (map.get(name) == this) { iter.remove(); @@ -734,9 +734,9 @@ public class TestLRUMap extends AbstractTestOrderedMap { public void testSynchronizedRemoveFromValues() throws InterruptedException { - final Map map = new LRUMap(10000); + final Map map = new LRUMap(10000); - final Map exceptions = new HashMap(); + final Map exceptions = new HashMap(); final ThreadGroup tg = new ThreadGroup(getName()) { @Override public void uncaughtException(Thread t, Throwable e) { @@ -766,7 +766,7 @@ public class TestLRUMap extends AbstractTestOrderedMap { } } synchronized (map) { - for (Iterator iter = map.values().iterator(); iter.hasNext();) { + for (Iterator iter = map.values().iterator(); iter.hasNext();) { if (iter.next() == this) { iter.remove(); } diff --git a/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java b/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java index 7acd5db93..7d845857c 100644 --- a/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java +++ b/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java @@ -68,18 +68,18 @@ public class TestMultiKeyMap extends AbstractTestIterableMap[] getMultiKeyKeys() { return new MultiKey[] { - new MultiKey(I1, I2), - new MultiKey(I2, I3), - new MultiKey(I3, I4), - new MultiKey(I1, I1, I2), - new MultiKey(I2, I3, I4), - new MultiKey(I3, I7, I6), - new MultiKey(I1, I1, I2, I3), - new MultiKey(I2, I4, I5, I6), - new MultiKey(I3, I6, I7, I8), - new MultiKey(I1, I1, I2, I3, I4), - new MultiKey(I2, I3, I4, I5, I6), - new MultiKey(I3, I5, I6, I7, I8), + new MultiKey(I1, I2), + new MultiKey(I2, I3), + new MultiKey(I3, I4), + new MultiKey(I1, I1, I2), + new MultiKey(I2, I3, I4), + new MultiKey(I3, I7, I6), + new MultiKey(I1, I1, I2, I3), + new MultiKey(I2, I4, I5, I6), + new MultiKey(I3, I6, I7, I8), + new MultiKey(I1, I1, I2, I3, I4), + new MultiKey(I2, I3, I4, I5, I6), + new MultiKey(I3, I5, I6, I7, I8), }; } @@ -108,11 +108,11 @@ public class TestMultiKeyMap extends AbstractTestIterableMap[] getOtherKeys() { - return (MultiKey[]) new MultiKey[] { - new MultiKey(I1, I7), - new MultiKey(I1, I8), - new MultiKey(I2, I4), - new MultiKey(I2, I5), + return new MultiKey[] { + new MultiKey(I1, I7), + new MultiKey(I1, I8), + new MultiKey(I2, I4), + new MultiKey(I2, I5), }; } diff --git a/src/test/org/apache/commons/collections/map/TestTransformedMap.java b/src/test/org/apache/commons/collections/map/TestTransformedMap.java index 86c7d1dbb..c7936fad4 100644 --- a/src/test/org/apache/commons/collections/map/TestTransformedMap.java +++ b/src/test/org/apache/commons/collections/map/TestTransformedMap.java @@ -101,7 +101,7 @@ public class TestTransformedMap extends AbstractTestIterableMap { assertEquals(new Integer(66), array[0].getValue()); assertEquals(new Integer(66), map.get(array[0].getKey())); - Map.Entry entry = (Map.Entry) entrySet.iterator().next(); + Map.Entry entry = entrySet.iterator().next(); entry.setValue("88"); assertEquals(new Integer(88), entry.getValue()); assertEquals(new Integer(88), map.get(entry.getKey())); diff --git a/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java b/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java index 84a3e9b2f..6e8249ce2 100644 --- a/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java +++ b/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java @@ -114,7 +114,7 @@ public class TestTransformedSortedMap extends AbstractTestSortedMap assertEquals(new Integer((String) els[0]), map.remove(els[0])); Set> entrySet = map.entrySet(); - Map.Entry[] array = (Map.Entry[]) entrySet.toArray(new Map.Entry[0]); + Map.Entry[] array = entrySet.toArray(new Map.Entry[0]); array[0].setValue((V) "66"); assertEquals(new Integer(66), array[0].getValue()); assertEquals(new Integer(66), map.get(array[0].getKey())); diff --git a/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java b/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java index 607306b81..70b689797 100644 --- a/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java +++ b/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java @@ -28,7 +28,7 @@ import org.apache.commons.collections.BulkTest; * To use, subclass and override the {@link #makeEmptySet()} * method. You may have to override other protected methods if your * set is not modifiable, or if your set restricts what kinds of - * elements may be added; see {@link AbstractTestCollection} for more details. + * elements may be added; see {@link AbstractTestSet} for more details. * * @since Commons Collections 3.0 * @version $Revision$ $Date$ diff --git a/src/test/org/apache/commons/collections/set/EmptySetMutator.java b/src/test/org/apache/commons/collections/set/EmptySetMutator.java index 428d13ba3..1de97097a 100644 --- a/src/test/org/apache/commons/collections/set/EmptySetMutator.java +++ b/src/test/org/apache/commons/collections/set/EmptySetMutator.java @@ -28,9 +28,9 @@ import org.apache.commons.collections.collection.CompositeCollection; * class also has to be serialized. */ class EmptySetMutator implements CompositeSet.SetMutator { - private Set contained; + private Set contained; - public EmptySetMutator(Set set) { + public EmptySetMutator(Set set) { this.contained = set; } diff --git a/src/test/org/apache/commons/collections/set/TestCompositeSet.java b/src/test/org/apache/commons/collections/set/TestCompositeSet.java index 0c1b03dbd..1b885c098 100644 --- a/src/test/org/apache/commons/collections/set/TestCompositeSet.java +++ b/src/test/org/apache/commons/collections/set/TestCompositeSet.java @@ -50,7 +50,7 @@ public class TestCompositeSet extends AbstractTestSet { public CompositeSet makeObject() { final HashSet contained = new HashSet(); CompositeSet set = new CompositeSet(contained); - set.setMutator( new EmptySetMutator(contained) ); + set.setMutator( new EmptySetMutator(contained) ); return set; } diff --git a/src/test/org/apache/commons/collections/set/TestTransformedSet.java b/src/test/org/apache/commons/collections/set/TestTransformedSet.java index 5d836bdfc..a65606fe6 100644 --- a/src/test/org/apache/commons/collections/set/TestTransformedSet.java +++ b/src/test/org/apache/commons/collections/set/TestTransformedSet.java @@ -97,12 +97,12 @@ public class TestTransformedSet extends AbstractTestSet { } public void testTransformedSet_decorateTransform() { - Set originalSet = new HashSet(); + Set originalSet = new HashSet(); Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"}; for (int i = 0; i < els.length; i++) { originalSet.add(els[i]); } - Set set = TransformedSet.decorateTransform(originalSet, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); + Set set = TransformedSet.decorateTransform(originalSet, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); assertEquals(els.length, set.size()); for (int i = 0; i < els.length; i++) { assertEquals(true, set.contains(new Integer((String) els[i]))); diff --git a/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java b/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java index 4b4d91117..32e91d693 100644 --- a/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java +++ b/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java @@ -83,12 +83,12 @@ public class TestTransformedSortedSet extends AbstractTestSortedSet { } public void testTransformedSet_decorateTransform() { - Set originalSet = new TreeSet(); + Set originalSet = new TreeSet(); Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"}; for (int i = 0; i < els.length; i++) { originalSet.add(els[i]); } - Set set = TransformedSortedSet.decorateTransform(originalSet, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); + Set set = TransformedSortedSet.decorateTransform(originalSet, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); assertEquals(els.length, set.size()); for (int i = 0; i < els.length; i++) { assertEquals(true, set.contains(new Integer((String) els[i]))); diff --git a/src/test/org/apache/commons/collections/splitmap/TestTransformedMap.java b/src/test/org/apache/commons/collections/splitmap/TestTransformedMap.java index b77fa4c6e..b04cb9444 100644 --- a/src/test/org/apache/commons/collections/splitmap/TestTransformedMap.java +++ b/src/test/org/apache/commons/collections/splitmap/TestTransformedMap.java @@ -42,7 +42,7 @@ public class TestTransformedMap extends BulkTest { private Transformer intToString = new Transformer() { public String transform(Integer input) { return String.valueOf(input); - }; + } }; private Transformer> objectToClass = new Transformer>() { @@ -71,13 +71,12 @@ public class TestTransformedMap extends BulkTest { } // ----------------------------------------------------------------------- - @SuppressWarnings("unchecked") public void testTransformedMap() { TransformedMap> map = TransformedMap.decorate( new HashMap>(), intToString, objectToClass); Integer[] k = new Integer[] { 0, 1, 2, 3, 4, 5, 6 }; - Object[] v = new Object[] { "", new Object(), new HashMap(), 0, BigInteger.TEN, null, + Object[] v = new Object[] { "", new Object(), new HashMap(), 0, BigInteger.TEN, null, new Object[0] }; assertEquals(0, map.size());