Author: sebb
Date: Wed Jul 21 19:06:17 2010
New Revision: 966367
URL: http://svn.apache.org/viewvc?rev=966367&view=rev
Log:
Fix up generics and other warnings
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/BulkTest.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/LocalTestNode.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestListUtils.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/bag/AbstractTestBag.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/bag/TestTransformedSortedBag.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/list/AbstractTestList.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/AbstractTestMap.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestFlat3Map.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestIdentityMap.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestLRUMap.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestTransformedMap.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/EmptySetMutator.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/TestCompositeSet.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/TestTransformedSet.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java
commons/proper/collections/trunk/src/test/org/apache/commons/collections/splitmap/TestTransformedMap.java
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/BulkTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/BulkTest.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/BulkTest.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/BulkTest.java
Wed Jul 21 19:06:17 2010
@@ -415,7 +415,7 @@ class BulkTestSuiteMaker {
private static <T extends BulkTest> BulkTest makeTestCase(Class<T> c,
Method m) {
Constructor<T> 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;
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/LocalTestNode.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/LocalTestNode.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/LocalTestNode.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/LocalTestNode.java
Wed Jul 21 19:06:17 2010
@@ -73,7 +73,7 @@ class LocalTestNode<K extends Comparable
/**
* 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<K extends Comparable
* @return true if equal
*/
@Override
- @SuppressWarnings("unchecked")
public boolean equals(Object o) {
if (o == null) {
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestListUtils.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestListUtils.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestListUtils.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestListUtils.java
Wed Jul 21 19:06:17 2010
@@ -115,8 +115,8 @@ public class TestListUtils extends BulkT
* Tests intersecting two lists in different orders.
*/
public void testIntersectionOrderInsensitivity() {
- List one = new ArrayList();
- List two = new ArrayList();
+ List<String> one = new ArrayList<String>();
+ List<String> two = new ArrayList<String>();
one.add("a");
one.add("b");
two.add("a");
@@ -237,7 +237,7 @@ public class TestListUtils extends BulkT
*/
// TODO: Generics
public void testIndexOf() {
- Predicate testPredicate = PredicateUtils.equalPredicate("d");
+ Predicate<String> testPredicate = PredicateUtils.equalPredicate("d");
int index = ListUtils.indexOf(fullList, testPredicate);
assertEquals(d, fullList.get(index));
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/bag/AbstractTestBag.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/bag/AbstractTestBag.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/bag/AbstractTestBag.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/bag/AbstractTestBag.java
Wed Jul 21 19:06:17 2010
@@ -374,7 +374,7 @@ public abstract class AbstractTestBag<T>
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<T>
}
//-----------------------------------------------------------------------
- @SuppressWarnings("unchecked")
public void testEmptyBagSerialization() throws IOException,
ClassNotFoundException {
Bag<T> 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<T>
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<T>
* 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<T> 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);
}
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/bag/TestTransformedSortedBag.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/bag/TestTransformedSortedBag.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/bag/TestTransformedSortedBag.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/bag/TestTransformedSortedBag.java
Wed Jul 21 19:06:17 2010
@@ -70,12 +70,12 @@ public class TestTransformedSortedBag<T>
}
public void testTransformedBag_decorateTransform() {
- Bag originalBag = new TreeBag();
+ Bag<Object> originalBag = new TreeBag<Object>();
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])));
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=966367&r1=966366&r2=966367&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 Jul 21 19:06:17 2010
@@ -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;
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java
Wed Jul 21 19:06:17 2010
@@ -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<K exte
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);
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/list/AbstractTestList.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/list/AbstractTestList.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/list/AbstractTestList.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/list/AbstractTestList.java
Wed Jul 21 19:06:17 2010
@@ -283,8 +283,8 @@ public abstract class AbstractTestList<E
for (int i = 0; i <= max; i++) {
resetFull();
- ((List<E>) getCollection()).add(i, element);
- ((List<E>) getConfirmed()).add(i, element);
+ getCollection().add(i, element);
+ getConfirmed().add(i, element);
verify();
}
}
@@ -621,9 +621,9 @@ public abstract class AbstractTestList<E
for (int i = 0; i < elements.length; i++) {
E n = other[i % other.length];
- E v = ((List<E>) getCollection()).set(i, n);
+ E v = (getCollection()).set(i, n);
assertEquals("Set should return correct element", elements[i], v);
- ((List<E>) getConfirmed()).set(i, n);
+ (getConfirmed()).set(i, n);
verify();
}
}
@@ -637,7 +637,7 @@ public abstract class AbstractTestList<E
resetFull();
try {
- ((List<E>) 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<E
int max = getFullElements().length;
for (int i = 0; i < max; i++) {
resetFull();
- E o1 = ((List<E>) getCollection()).remove(i);
- E o2 = ((List<E>) getConfirmed()).remove(i);
+ E o1 = (getCollection()).remove(i);
+ E o2 = (getConfirmed()).remove(i);
assertEquals("remove should return correct element", o1, o2);
verify();
}
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/AbstractTestMap.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/AbstractTestMap.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/AbstractTestMap.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/AbstractTestMap.java
Wed Jul 21 19:06:17 2010
@@ -745,7 +745,6 @@ public abstract class AbstractTestMap<K,
* 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<K,
*/
// test to make sure the canonical form has been preserved
- Map map = makeObject();
+ Map<K, V> map = makeObject();
if (map instanceof Serializable && !skipSerializedCanonicalTests() &&
isTestSerialization()) {
- Map map2 = (Map)
readExternalFormFromDisk(getCanonicalEmptyCollectionName(map));
+ @SuppressWarnings("unchecked")
+ Map<K, V> map2 = (Map<K, V>)
readExternalFormFromDisk(getCanonicalEmptyCollectionName(map));
assertEquals("Map is empty", 0, map2.size());
}
}
@@ -767,7 +767,6 @@ public abstract class AbstractTestMap<K,
* 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<K,
*/
// test to make sure the canonical form has been preserved
- Map map = makeFullMap();
+ Map<K, V> map = makeFullMap();
if (map instanceof Serializable && !skipSerializedCanonicalTests() &&
isTestSerialization()) {
- Map map2 = (Map)
readExternalFormFromDisk(getCanonicalFullCollectionName(map));
+ @SuppressWarnings("unchecked")
+ Map<K, V> map2 = (Map<K, V>)
readExternalFormFromDisk(getCanonicalFullCollectionName(map));
assertEquals("Map is the right size", getSampleKeys().length,
map2.size());
}
}
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java
Wed Jul 21 19:06:17 2010
@@ -142,7 +142,7 @@ public class TestCaseInsensitiveMap<K, V
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<String, String> map = new
CaseInsensitiveMap<String, String>();
map.put(data[j][0], "value");
assertEquals(Locale.getDefault() + ": " + j, "value",
map.get(data[j][1]));
}
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestFlat3Map.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestFlat3Map.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestFlat3Map.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestFlat3Map.java
Wed Jul 21 19:06:17 2010
@@ -154,7 +154,6 @@ public class TestFlat3Map<K, V> extends
assertSame(TWO, cloned.get(TWENTY));
}
- @SuppressWarnings("unchecked")
public void testSerialisation0() throws Exception {
Flat3Map<K, V> map = makeObject();
ByteArrayOutputStream bout = new ByteArrayOutputStream();
@@ -164,7 +163,7 @@ public class TestFlat3Map<K, V> extends
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<K, V> extends
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<K, V> extends
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<K, V> extends
// }
public void testCollections261() {
- Flat3Map m = new Flat3Map();
+ Flat3Map<Integer, Integer> m = new Flat3Map<Integer, Integer>();
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) ) );
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestIdentityMap.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestIdentityMap.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestIdentityMap.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestIdentityMap.java
Wed Jul 21 19:06:17 2010
@@ -121,12 +121,12 @@ public class TestIdentityMap<K, V> exten
* 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<K, V> map = makeObject();
if (map instanceof Serializable && !skipSerializedCanonicalTests()) {
- Map map2 = (Map)
readExternalFormFromDisk(getCanonicalEmptyCollectionName(map));
+ @SuppressWarnings("unchecked")
+ Map<K, V> map2 = (Map<K, V>)
readExternalFormFromDisk(getCanonicalEmptyCollectionName(map));
assertEquals("Map is empty", 0, map2.size());
}
}
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestLRUMap.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestLRUMap.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestLRUMap.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestLRUMap.java
Wed Jul 21 19:06:17 2010
@@ -238,7 +238,7 @@ public class TestLRUMap<K, V> extends Ab
@SuppressWarnings("unchecked")
public void testRemoveLRU() {
- MockLRUMapSubclass map = new MockLRUMapSubclass(2);
+ MockLRUMapSubclass<K, String> map = new MockLRUMapSubclass<K,
String>(2);
assertNull(map.entry);
map.put((K) "A", "a");
assertNull(map.entry);
@@ -484,9 +484,9 @@ public class TestLRUMap<K, V> extends Ab
// TODO: COLLECTIONS-330
public void todoTestSynchronizedRemoveFromMapIterator() throws
InterruptedException {
- final LRUMap map = new LRUMap(10000);
+ final LRUMap<Object, Thread> map = new LRUMap<Object, Thread>(10000);
- final Map exceptions = new HashMap();
+ final Map<Throwable, String> exceptions = new HashMap<Throwable,
String>();
final ThreadGroup tg = new ThreadGroup(getName()) {
@Override
public void uncaughtException(Thread t, Throwable e) {
@@ -516,7 +516,7 @@ public class TestLRUMap<K, V> extends Ab
}
}
synchronized (map) {
- for (MapIterator iter = map.mapIterator();
iter.hasNext();) {
+ for (MapIterator<Object, Thread> iter =
map.mapIterator(); iter.hasNext();) {
String name = (String)iter.next();
if (map.get(name) == this) {
iter.remove();
@@ -567,9 +567,9 @@ public class TestLRUMap<K, V> extends Ab
public void testSynchronizedRemoveFromEntrySet() throws
InterruptedException {
- final Map map = new LRUMap(10000);
+ final Map<Object, Thread> map = new LRUMap<Object, Thread>(10000);
- final Map exceptions = new HashMap();
+ final Map<Throwable, String> exceptions = new HashMap<Throwable,
String>();
final ThreadGroup tg = new ThreadGroup(getName()) {
@Override
public void uncaughtException(Thread t, Throwable e) {
@@ -599,8 +599,8 @@ public class TestLRUMap<K, V> extends Ab
}
}
synchronized (map) {
- for (Iterator iter = map.entrySet().iterator();
iter.hasNext();) {
- Map.Entry entry = (Map.Entry)iter.next();
+ for (Iterator<Map.Entry<Object, Thread>> iter =
map.entrySet().iterator(); iter.hasNext();) {
+ Map.Entry<Object, Thread> entry = iter.next();
if (entry.getValue() == this) {
iter.remove();
}
@@ -651,9 +651,9 @@ public class TestLRUMap<K, V> extends Ab
// TODO: COLLECTIONS-330
public void todoTestSynchronizedRemoveFromKeySet() throws
InterruptedException {
- final Map map = new LRUMap(10000);
+ final Map<Object, Thread> map = new LRUMap<Object, Thread>(10000);
- final Map exceptions = new HashMap();
+ final Map<Throwable, String> exceptions = new HashMap<Throwable,
String>();
final ThreadGroup tg = new ThreadGroup(getName()) {
@Override
public void uncaughtException(Thread t, Throwable e) {
@@ -683,7 +683,7 @@ public class TestLRUMap<K, V> extends Ab
}
}
synchronized (map) {
- for (Iterator iter = map.keySet().iterator();
iter.hasNext();) {
+ for (Iterator<Object> 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<K, V> extends Ab
public void testSynchronizedRemoveFromValues() throws InterruptedException
{
- final Map map = new LRUMap(10000);
+ final Map<Object, Thread> map = new LRUMap<Object, Thread>(10000);
- final Map exceptions = new HashMap();
+ final Map<Throwable, String> exceptions = new HashMap<Throwable,
String>();
final ThreadGroup tg = new ThreadGroup(getName()) {
@Override
public void uncaughtException(Thread t, Throwable e) {
@@ -766,7 +766,7 @@ public class TestLRUMap<K, V> extends Ab
}
}
synchronized (map) {
- for (Iterator iter = map.values().iterator();
iter.hasNext();) {
+ for (Iterator<Thread> iter =
map.values().iterator(); iter.hasNext();) {
if (iter.next() == this) {
iter.remove();
}
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java
Wed Jul 21 19:06:17 2010
@@ -68,18 +68,18 @@ public class TestMultiKeyMap<K, V> exten
@SuppressWarnings("unchecked")
private MultiKey<K>[] 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<Integer>(I1, I2),
+ new MultiKey<Integer>(I2, I3),
+ new MultiKey<Integer>(I3, I4),
+ new MultiKey<Integer>(I1, I1, I2),
+ new MultiKey<Integer>(I2, I3, I4),
+ new MultiKey<Integer>(I3, I7, I6),
+ new MultiKey<Integer>(I1, I1, I2, I3),
+ new MultiKey<Integer>(I2, I4, I5, I6),
+ new MultiKey<Integer>(I3, I6, I7, I8),
+ new MultiKey<Integer>(I1, I1, I2, I3, I4),
+ new MultiKey<Integer>(I2, I3, I4, I5, I6),
+ new MultiKey<Integer>(I3, I5, I6, I7, I8),
};
}
@@ -108,11 +108,11 @@ public class TestMultiKeyMap<K, V> exten
@Override
@SuppressWarnings("unchecked")
public MultiKey<K>[] getOtherKeys() {
- return (MultiKey<K>[]) new MultiKey[] {
- new MultiKey(I1, I7),
- new MultiKey(I1, I8),
- new MultiKey(I2, I4),
- new MultiKey(I2, I5),
+ return new MultiKey[] {
+ new MultiKey<Integer>(I1, I7),
+ new MultiKey<Integer>(I1, I8),
+ new MultiKey<Integer>(I2, I4),
+ new MultiKey<Integer>(I2, I5),
};
}
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestTransformedMap.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestTransformedMap.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestTransformedMap.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestTransformedMap.java
Wed Jul 21 19:06:17 2010
@@ -101,7 +101,7 @@ public class TestTransformedMap<K, V> ex
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()));
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java
Wed Jul 21 19:06:17 2010
@@ -114,7 +114,7 @@ public class TestTransformedSortedMap<K,
assertEquals(new Integer((String) els[0]), map.remove(els[0]));
Set<Map.Entry<K, V>> entrySet = map.entrySet();
- Map.Entry<K, V>[] array = (Map.Entry<K, V>[]) entrySet.toArray(new
Map.Entry[0]);
+ Map.Entry<K, V>[] 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()));
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java
Wed Jul 21 19:06:17 2010
@@ -28,7 +28,7 @@ import org.apache.commons.collections.Bu
* 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$
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/EmptySetMutator.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/EmptySetMutator.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/EmptySetMutator.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/EmptySetMutator.java
Wed Jul 21 19:06:17 2010
@@ -28,9 +28,9 @@ import org.apache.commons.collections.co
* class also has to be serialized.
*/
class EmptySetMutator<E> implements CompositeSet.SetMutator<E> {
- private Set contained;
+ private Set<E> contained;
- public EmptySetMutator(Set set) {
+ public EmptySetMutator(Set<E> set) {
this.contained = set;
}
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/TestCompositeSet.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/TestCompositeSet.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/TestCompositeSet.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/TestCompositeSet.java
Wed Jul 21 19:06:17 2010
@@ -50,7 +50,7 @@ public class TestCompositeSet<E> extends
public CompositeSet<E> makeObject() {
final HashSet<E> contained = new HashSet<E>();
CompositeSet<E> set = new CompositeSet<E>(contained);
- set.setMutator( new EmptySetMutator(contained) );
+ set.setMutator( new EmptySetMutator<E>(contained) );
return set;
}
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/TestTransformedSet.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/TestTransformedSet.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/TestTransformedSet.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/TestTransformedSet.java
Wed Jul 21 19:06:17 2010
@@ -97,12 +97,12 @@ public class TestTransformedSet<E> exten
}
public void testTransformedSet_decorateTransform() {
- Set originalSet = new HashSet();
+ Set<Object> originalSet = new HashSet<Object>();
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])));
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java
Wed Jul 21 19:06:17 2010
@@ -83,12 +83,12 @@ public class TestTransformedSortedSet<E>
}
public void testTransformedSet_decorateTransform() {
- Set originalSet = new TreeSet();
+ Set<Object> originalSet = new TreeSet<Object>();
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])));
Modified:
commons/proper/collections/trunk/src/test/org/apache/commons/collections/splitmap/TestTransformedMap.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/splitmap/TestTransformedMap.java?rev=966367&r1=966366&r2=966367&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/org/apache/commons/collections/splitmap/TestTransformedMap.java
(original)
+++
commons/proper/collections/trunk/src/test/org/apache/commons/collections/splitmap/TestTransformedMap.java
Wed Jul 21 19:06:17 2010
@@ -42,7 +42,7 @@ public class TestTransformedMap extends
private Transformer<Integer, String> intToString = new
Transformer<Integer, String>() {
public String transform(Integer input) {
return String.valueOf(input);
- };
+ }
};
private Transformer<Object, Class<?>> objectToClass = new
Transformer<Object, Class<?>>() {
@@ -71,13 +71,12 @@ public class TestTransformedMap extends
}
// -----------------------------------------------------------------------
- @SuppressWarnings("unchecked")
public void testTransformedMap() {
TransformedMap<Integer, String, Object, Class<?>> map =
TransformedMap.decorate(
new HashMap<String, Class<?>>(), 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<Object,
Object>(), 0, BigInteger.TEN, null,
new Object[0] };
assertEquals(0, map.size());