Fixes/supresses warnings in test due to usage of classes with generics.
Change-Id: I48217242b79fb3c8638478f5f30382f361cb3e94
Review-Link: https://gwt-review.googlesource.com/#/c/1491/
Review by: mdempsky@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@11434 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/test/org/apache/commons/collections/collection/AbstractTestCollection.java b/dev/core/test/org/apache/commons/collections/collection/AbstractTestCollection.java
index 2071e3d..a3591db 100644
--- a/dev/core/test/org/apache/commons/collections/collection/AbstractTestCollection.java
+++ b/dev/core/test/org/apache/commons/collections/collection/AbstractTestCollection.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.collections.collection;
+import org.apache.commons.collections.AbstractTestObject;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
@@ -34,8 +36,6 @@
import java.util.Map;
import java.util.NoSuchElementException;
-import org.apache.commons.collections.AbstractTestObject;
-
/**
* Abstract test class for {@link java.util.Collection} methods and contracts.
* <p>
@@ -121,6 +121,7 @@
* @author Neil O'Toole
* @author Stephen Colebourne
*/
+@SuppressWarnings({"unchecked", "rawtypes"})
public abstract class AbstractTestCollection extends AbstractTestObject {
//
diff --git a/dev/core/test/org/apache/commons/collections/iterators/AbstractTestIterator.java b/dev/core/test/org/apache/commons/collections/iterators/AbstractTestIterator.java
index d2e6870..a9ce434 100644
--- a/dev/core/test/org/apache/commons/collections/iterators/AbstractTestIterator.java
+++ b/dev/core/test/org/apache/commons/collections/iterators/AbstractTestIterator.java
@@ -16,11 +16,11 @@
*/
package org.apache.commons.collections.iterators;
+import org.apache.commons.collections.AbstractTestObject;
+
import java.util.Iterator;
import java.util.NoSuchElementException;
-import org.apache.commons.collections.AbstractTestObject;
-
/**
* Abstract class for testing the Iterator interface.
* <p>
@@ -35,6 +35,7 @@
* @author Morgan Delagrange
* @author Stephen Colebourne
*/
+@SuppressWarnings({"unchecked", "rawtypes"})
public abstract class AbstractTestIterator extends AbstractTestObject {
/**
diff --git a/dev/core/test/org/apache/commons/collections/iterators/AbstractTestMapIterator.java b/dev/core/test/org/apache/commons/collections/iterators/AbstractTestMapIterator.java
index 5bd5191..b5e7e01 100644
--- a/dev/core/test/org/apache/commons/collections/iterators/AbstractTestMapIterator.java
+++ b/dev/core/test/org/apache/commons/collections/iterators/AbstractTestMapIterator.java
@@ -16,14 +16,14 @@
*/
package org.apache.commons.collections.iterators;
+import org.apache.commons.collections.MapIterator;
+
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
-import org.apache.commons.collections.MapIterator;
-
/**
* Abstract class for testing the MapIterator interface.
* <p>
@@ -37,6 +37,7 @@
*
* @author Stephen Colebourne
*/
+@SuppressWarnings({"unchecked", "rawtypes"})
public abstract class AbstractTestMapIterator extends AbstractTestIterator {
/**
diff --git a/dev/core/test/org/apache/commons/collections/map/AbstractTestIterableMap.java b/dev/core/test/org/apache/commons/collections/map/AbstractTestIterableMap.java
index 46b0436..a9d1250 100644
--- a/dev/core/test/org/apache/commons/collections/map/AbstractTestIterableMap.java
+++ b/dev/core/test/org/apache/commons/collections/map/AbstractTestIterableMap.java
@@ -16,15 +16,15 @@
*/
package org.apache.commons.collections.map;
+import org.apache.commons.collections.BulkTest;
+import org.apache.commons.collections.IterableMap;
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.iterators.AbstractTestMapIterator;
+
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.Map;
-import org.apache.commons.collections.IterableMap;
-import org.apache.commons.collections.BulkTest;
-import org.apache.commons.collections.MapIterator;
-import org.apache.commons.collections.iterators.AbstractTestMapIterator;
-
/**
* Abstract test class for {@link IterableMap} methods and contracts.
*
@@ -32,6 +32,7 @@
*
* @author Stephen Colebourne
*/
+@SuppressWarnings({"unchecked", "rawtypes"})
public abstract class AbstractTestIterableMap extends AbstractTestMap {
/**
diff --git a/dev/core/test/org/apache/commons/collections/map/AbstractTestMap.java b/dev/core/test/org/apache/commons/collections/map/AbstractTestMap.java
index 433a665..3d4668f 100644
--- a/dev/core/test/org/apache/commons/collections/map/AbstractTestMap.java
+++ b/dev/core/test/org/apache/commons/collections/map/AbstractTestMap.java
@@ -16,6 +16,11 @@
*/
package org.apache.commons.collections.map;
+import org.apache.commons.collections.AbstractTestObject;
+import org.apache.commons.collections.BulkTest;
+import org.apache.commons.collections.collection.AbstractTestCollection;
+import org.apache.commons.collections.set.AbstractTestSet;
+
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
@@ -25,11 +30,6 @@
import java.util.Map;
import java.util.Set;
-import org.apache.commons.collections.AbstractTestObject;
-import org.apache.commons.collections.BulkTest;
-import org.apache.commons.collections.collection.AbstractTestCollection;
-import org.apache.commons.collections.set.AbstractTestSet;
-
/**
* Abstract test class for {@link java.util.Map} methods and contracts.
* <p>
@@ -119,6 +119,7 @@
* @author Stephen Colebourne
* @version $Revision: 646780 $ $Date: 2008-04-10 13:48:07 +0100 (Thu, 10 Apr 2008) $
*/
+@SuppressWarnings({"unchecked", "rawtypes"})
public abstract class AbstractTestMap extends AbstractTestObject {
/**
diff --git a/dev/core/test/org/apache/commons/collections/map/TestIdentityMap.java b/dev/core/test/org/apache/commons/collections/map/TestIdentityMap.java
index 13e042a..532ac95 100644
--- a/dev/core/test/org/apache/commons/collections/map/TestIdentityMap.java
+++ b/dev/core/test/org/apache/commons/collections/map/TestIdentityMap.java
@@ -16,11 +16,6 @@
*/
package org.apache.commons.collections.map;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.Iterator;
-import java.util.Map;
-
import junit.framework.Test;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
@@ -28,6 +23,11 @@
import org.apache.commons.collections.AbstractTestObject;
import org.apache.commons.collections.IterableMap;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.Map;
+
/**
* JUnit tests.
*
@@ -35,6 +35,7 @@
*
* @author Stephen Colebourne
*/
+@SuppressWarnings({"unchecked", "rawtypes"})
public class TestIdentityMap extends AbstractTestObject {
private static final Integer I1A = new Integer(1);
diff --git a/dev/core/test/org/apache/commons/collections/set/AbstractTestSet.java b/dev/core/test/org/apache/commons/collections/set/AbstractTestSet.java
index 398fa78..dc3a3d4 100644
--- a/dev/core/test/org/apache/commons/collections/set/AbstractTestSet.java
+++ b/dev/core/test/org/apache/commons/collections/set/AbstractTestSet.java
@@ -16,14 +16,14 @@
*/
package org.apache.commons.collections.set;
+import org.apache.commons.collections.collection.AbstractTestCollection;
+
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-import org.apache.commons.collections.collection.AbstractTestCollection;
-
/**
* Abstract test class for {@link Set} methods and contracts.
* <p>
@@ -43,6 +43,7 @@
*
* @author Paul Jack
*/
+@SuppressWarnings({"unchecked", "rawtypes"})
public abstract class AbstractTestSet extends AbstractTestCollection {
/**
diff --git a/user/test/com/google/gwt/dev/jjs/test/VarargsTest.java b/user/test/com/google/gwt/dev/jjs/test/VarargsTest.java
index 0285390..a615d1f 100644
--- a/user/test/com/google/gwt/dev/jjs/test/VarargsTest.java
+++ b/user/test/com/google/gwt/dev/jjs/test/VarargsTest.java
@@ -28,6 +28,7 @@
return "com.google.gwt.dev.jjs.CompilerSuite";
}
+ @SuppressWarnings("all")
public void testNullEmpty() {
assertNotNull(vararg());
assertNull(vararg(null));
diff --git a/user/test/com/google/gwt/dev/shell/test/MultiModuleTest.java b/user/test/com/google/gwt/dev/shell/test/MultiModuleTest.java
index ff3a48c..8eb5f6f 100644
--- a/user/test/com/google/gwt/dev/shell/test/MultiModuleTest.java
+++ b/user/test/com/google/gwt/dev/shell/test/MultiModuleTest.java
@@ -23,7 +23,6 @@
import com.google.gwt.user.client.ui.VerticalPanel;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
/**
@@ -111,14 +110,14 @@
*/
public void testInnerModules() {
String url = getURL();
- Map params = getURLParams(url);
+ Map<String, String> params = getURLParams(url);
if (!params.containsKey("gwt.junit.testfuncname")) {
// if this test is being run as a normal JUnit test, return success
return;
}
// we were invoked by testMultipleModules, get the frame to load
- String frameName = (String) params.get("frame");
+ String frameName = params.get("frame");
VerticalPanel panel = new VerticalPanel();
RootPanel.get().add(panel);
@@ -167,7 +166,7 @@
// build new URL from current one
String url = getURL();
- Map params = getURLParams(url);
+ Map<String, String> params = getURLParams(url);
params.put("frame", "top");
params.put("gwt.junit.testclassname", MultiModuleTest.class.getName());
params.put("gwt.junit.testfuncname", "testInnerModules");
@@ -207,7 +206,7 @@
* @param params a map of parameter names to values
* @return the revised URL
*/
- private String buildURL(String url, Map params) {
+ private String buildURL(String url, Map<String, String> params) {
// strip off the query string if present
int pos = url.indexOf("?");
@@ -225,9 +224,8 @@
}
// now add the rest of the parameters, excluding gwt.hybrid
- for (Iterator it = params.entrySet().iterator(); it.hasNext();) {
- Map.Entry entry = (Map.Entry) it.next();
- String param = (String) entry.getKey();
+ for (Map.Entry<String, String> entry : params.entrySet()) {
+ String param = entry.getKey();
if (param.equals("gwt.hybrid")) {
// we already included gwt.hybrid if it was present
@@ -244,7 +242,7 @@
url += param;
// add the value if necessary
- String value = (String) entry.getValue();
+ String value = entry.getValue();
if (value != null) {
url += "=" + value;
}
@@ -268,7 +266,7 @@
*/
private void doneLoading() {
String url = getURL();
- Map params = getURLParams(url);
+ Map<String, String> params = getURLParams(url);
mainPanel.add(new Label("done loading"));
if (++state == 4) {
// all tests complete, notify parent
@@ -306,8 +304,8 @@
* @param url the full or partial (ie, only location.search) URL to parse
* @return the map of parameter names to values
*/
- private Map getURLParams(String url) {
- HashMap map = new HashMap();
+ private Map<String, String> getURLParams(String url) {
+ HashMap<String, String> map = new HashMap<String, String>();
int pos = url.indexOf("?");
// loop precondition: pos is the index of the next ? or & character in url
@@ -372,7 +370,7 @@
*
* @param frameNumber the number of the frame to replace, starting with 0
*/
- private void toggleFrame(int frameNumber, String url, Map params) {
+ private void toggleFrame(int frameNumber, String url, Map<String, String> params) {
params.put("frame", (frameNumber + 1) + (frameB[frameNumber] ? "a" : "b"));
frame[frameNumber].setUrl(buildURL(url, params));
frameB[frameNumber] = !frameB[frameNumber];
diff --git a/user/test/com/google/gwt/emultest/java/util/ComparatorTest.java b/user/test/com/google/gwt/emultest/java/util/ComparatorTest.java
index 939e75e..e46d534 100644
--- a/user/test/com/google/gwt/emultest/java/util/ComparatorTest.java
+++ b/user/test/com/google/gwt/emultest/java/util/ComparatorTest.java
@@ -25,12 +25,12 @@
* TODO: document me.
*/
public class ComparatorTest extends TestComparator {
- public Comparator makeComparator() {
+ public Comparator<Object> makeComparator() {
return new DummyComparator();
}
- public List getComparableObjectsOrdered() {
- List l = new ArrayList();
+ public List<Object> getComparableObjectsOrdered() {
+ List<Object> l = new ArrayList<Object>();
l.add("x");
l.add("y");
l.add("z");
@@ -41,7 +41,7 @@
/**
* List comparator for testing.
*/
-class DummyComparator implements Comparator {
+class DummyComparator implements Comparator<Object> {
/**
* Compares returns reverse hash order.
*/
diff --git a/user/test/com/google/gwt/emultest/java/util/HashMapTest.java b/user/test/com/google/gwt/emultest/java/util/HashMapTest.java
index 2f7be81..2b78350 100644
--- a/user/test/com/google/gwt/emultest/java/util/HashMapTest.java
+++ b/user/test/com/google/gwt/emultest/java/util/HashMapTest.java
@@ -25,12 +25,10 @@
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
-import java.util.Map.Entry;
/**
* Tests <code>HashMap</code>.
*/
-@SuppressWarnings("unchecked")
public class HashMapTest extends TestMap {
private static final int CAPACITY_16 = 16;
private static final int CAPACITY_NEG_ONE_HALF = -1;
@@ -90,7 +88,7 @@
private static final String VALUE_TEST_REMOVE = KEY_TEST_REMOVE + " - value";
private static final String VALUE_VAL = "value";
- private static void assertEmptyIterator(Iterator it) {
+ private static void assertEmptyIterator(Iterator<?> it) {
assertNotNull(it);
assertFalse(it.hasNext());
try {
@@ -105,7 +103,7 @@
*
* @param hashMap
*/
- private static void checkEmptyHashMapAssumptions(HashMap hashMap) {
+ private static void checkEmptyHashMapAssumptions(HashMap<?, ?> hashMap) {
assertNotNull(hashMap);
assertTrue(hashMap.isEmpty());
@@ -130,7 +128,7 @@
}
public void testAddEqualKeys() {
- final HashMap expected = new HashMap();
+ final HashMap<Number, Object> expected = new HashMap<Number, Object>();
assertEquals(expected.size(), 0);
iterateThrough(expected);
expected.put(new Long(45), new Object());
@@ -143,7 +141,7 @@
}
public void testAddWatch() {
- HashMap m = new HashMap();
+ HashMap<String, String> m = new HashMap<String, String>();
m.put("watch", "watch");
assertEquals(m.get("watch"), "watch");
}
@@ -152,7 +150,7 @@
* Test method for 'java.util.HashMap.clear()'
*/
public void testClear() {
- HashMap hashMap = new HashMap();
+ HashMap<String, String> hashMap = new HashMap<String, String>();
checkEmptyHashMapAssumptions(hashMap);
hashMap.put("Hello", "Bye");
@@ -168,11 +166,10 @@
* Test method for 'java.util.HashMap.clone()'
*/
public void testClone() {
- HashMap srcMap = new HashMap();
+ HashMap<String, String> srcMap = new HashMap<String, String>();
checkEmptyHashMapAssumptions(srcMap);
- // Check empty clone behavior
- HashMap dstMap = (HashMap) srcMap.clone();
+ HashMap<String, String> dstMap = cloneMap(srcMap);
assertNotNull(dstMap);
assertEquals(dstMap.size(), srcMap.size());
// assertTrue(dstMap.values().toArray().equals(srcMap.values().toArray()));
@@ -183,7 +180,7 @@
srcMap.put(KEY_1, VALUE_1);
srcMap.put(KEY_2, VALUE_2);
srcMap.put(KEY_3, VALUE_3);
- dstMap = (HashMap) srcMap.clone();
+ dstMap = cloneMap(srcMap);
assertNotNull(dstMap);
assertEquals(dstMap.size(), srcMap.size());
@@ -196,7 +193,7 @@
* Test method for 'java.util.HashMap.containsKey(Object)'
*/
public void testContainsKey() {
- HashMap hashMap = new HashMap();
+ HashMap<String, Integer> hashMap = new HashMap<String, Integer>();
checkEmptyHashMapAssumptions(hashMap);
assertFalse(hashMap.containsKey(KEY_TEST_CONTAINS_KEY));
@@ -213,7 +210,7 @@
* Test method for 'java.util.HashMap.containsValue(Object)'
*/
public void testContainsValue() {
- HashMap hashMap = new HashMap();
+ HashMap<String, Integer> hashMap = new HashMap<String, Integer>();
checkEmptyHashMapAssumptions(hashMap);
assertFalse("check contains of empty map",
@@ -233,18 +230,18 @@
* Test method for 'java.util.HashMap.entrySet()'
*/
public void testEntrySet() {
- HashMap hashMap = new HashMap();
+ HashMap<String, String> hashMap = new HashMap<String, String>();
checkEmptyHashMapAssumptions(hashMap);
- Set entrySet = hashMap.entrySet();
+ Set<Map.Entry<String, String>> entrySet = hashMap.entrySet();
assertNotNull(entrySet);
// Check that the entry set looks right
hashMap.put(KEY_TEST_ENTRY_SET, VALUE_TEST_ENTRY_SET_1);
entrySet = hashMap.entrySet();
assertEquals(entrySet.size(), SIZE_ONE);
- Iterator itSet = entrySet.iterator();
- Map.Entry entry = (Map.Entry) itSet.next();
+ Iterator<Map.Entry<String, String>> itSet = entrySet.iterator();
+ Map.Entry<String, String> entry = itSet.next();
assertEquals(entry.getKey(), KEY_TEST_ENTRY_SET);
assertEquals(entry.getValue(), VALUE_TEST_ENTRY_SET_1);
assertEmptyIterator(itSet);
@@ -254,7 +251,7 @@
entrySet = hashMap.entrySet();
assertEquals(entrySet.size(), SIZE_ONE);
itSet = entrySet.iterator();
- entry = (Map.Entry) itSet.next();
+ entry = itSet.next();
assertEquals(entry.getKey(), KEY_TEST_ENTRY_SET);
assertEquals(entry.getValue(), VALUE_TEST_ENTRY_SET_2);
assertEmptyIterator(itSet);
@@ -268,16 +265,16 @@
* Used to test the entrySet entry's set method.
*/
public void testEntrySetEntrySetterNonString() {
- HashMap hashMap = new HashMap();
+ HashMap<Integer, Integer> hashMap = new HashMap<Integer, Integer>();
hashMap.put(1, 2);
- Set entrySet = hashMap.entrySet();
- Entry entry = (Entry) entrySet.iterator().next();
+ Set<Map.Entry<Integer, Integer>> entrySet = hashMap.entrySet();
+ Map.Entry<Integer, Integer> entry = entrySet.iterator().next();
entry.setValue(3);
- assertEquals(3, hashMap.get(1));
+ assertEquals(3, hashMap.get(1).intValue());
hashMap.put(1, 4);
- assertEquals(4, entry.getValue());
+ assertEquals(4, entry.getValue().intValue());
assertEquals(1, hashMap.size());
}
@@ -286,16 +283,16 @@
* Used to test the entrySet entry's set method.
*/
public void testEntrySetEntrySetterNull() {
- HashMap hashMap = new HashMap();
+ HashMap<String, Integer> hashMap = new HashMap<String, Integer>();
hashMap.put(null, 2);
- Set entrySet = hashMap.entrySet();
- Entry entry = (Entry) entrySet.iterator().next();
+ Set<Map.Entry<String, Integer>> entrySet = hashMap.entrySet();
+ Map.Entry<String, Integer> entry = entrySet.iterator().next();
entry.setValue(3);
- assertEquals(3, hashMap.get(null));
+ assertEquals(3, hashMap.get(null).intValue());
hashMap.put(null, 4);
- assertEquals(4, entry.getValue());
+ assertEquals(4, entry.getValue().intValue());
assertEquals(1, hashMap.size());
}
@@ -304,10 +301,10 @@
* Used to test the entrySet entry's set method.
*/
public void testEntrySetEntrySetterString() {
- HashMap hashMap = new HashMap();
+ HashMap<String, String> hashMap = new HashMap<String, String>();
hashMap.put("A", "B");
- Set entrySet = hashMap.entrySet();
- Entry entry = (Entry) entrySet.iterator().next();
+ Set<Map.Entry<String, String>> entrySet = hashMap.entrySet();
+ Map.Entry<String, String> entry = entrySet.iterator().next();
entry.setValue("C");
assertEquals("C", hashMap.get("A"));
@@ -322,12 +319,12 @@
* Used to test the entrySet remove method.
*/
public void testEntrySetRemove() {
- HashMap hashMap = new HashMap();
+ HashMap<String, String> hashMap = new HashMap<String, String>();
hashMap.put("A", "B");
- HashMap dummy = new HashMap();
+ HashMap<String, String> dummy = new HashMap<String, String>();
dummy.put("A", "b");
- Entry bogus = (Entry) dummy.entrySet().iterator().next();
- Set entrySet = hashMap.entrySet();
+ Map.Entry<String, String> bogus = dummy.entrySet().iterator().next();
+ Set<Map.Entry<String, String>> entrySet = hashMap.entrySet();
boolean removed = entrySet.remove(bogus);
assertEquals(removed, false);
assertEquals(hashMap.get("A"), "B");
@@ -337,18 +334,23 @@
* Test method for 'java.util.AbstractMap.equals(Object)'
*/
public void testEquals() {
- HashMap hashMap = new HashMap();
+ HashMap<String, String> hashMap = new HashMap<String, String>();
checkEmptyHashMapAssumptions(hashMap);
hashMap.put(KEY_KEY, VALUE_VAL);
- HashMap copyMap = (HashMap) hashMap.clone();
+ HashMap<String, String> copyMap = cloneMap(hashMap);
assertTrue(hashMap.equals(copyMap));
hashMap.put(VALUE_VAL, KEY_KEY);
assertFalse(hashMap.equals(copyMap));
}
+ @SuppressWarnings("unchecked")
+ private HashMap<String, String> cloneMap(HashMap<String, String> hashMap) {
+ return (HashMap<String, String>) hashMap.clone();
+ }
+
/*
* Test method for 'java.lang.Object.finalize()'.
*/
@@ -360,7 +362,7 @@
* Test method for 'java.util.HashMap.get(Object)'.
*/
public void testGet() {
- HashMap hashMap = new HashMap();
+ HashMap<String, String> hashMap = new HashMap<String, String>();
checkEmptyHashMapAssumptions(hashMap);
assertNull(hashMap.get(KEY_TEST_GET));
@@ -379,7 +381,7 @@
* Test method for 'java.util.AbstractMap.hashCode()'.
*/
public void testHashCode() {
- HashMap hashMap = new HashMap();
+ HashMap<String, String> hashMap = new HashMap<String, String>();
checkEmptyHashMapAssumptions(hashMap);
// Check that hashCode changes
@@ -394,7 +396,7 @@
* Test method for 'java.util.HashMap.HashMap()'.
*/
public void testHashMap() {
- HashMap hashMap = new HashMap();
+ HashMap<String, String> hashMap = new HashMap<String, String>();
checkEmptyHashMapAssumptions(hashMap);
}
@@ -402,13 +404,13 @@
* Test method for 'java.util.HashMap.HashMap(int)'
*/
public void testHashMapInt() {
- HashMap hashMap = new HashMap(CAPACITY_16);
+ HashMap<String, String> hashMap = new HashMap<String, String>(CAPACITY_16);
checkEmptyHashMapAssumptions(hashMap);
// TODO(mmendez): how do we verify capacity?
boolean failed = true;
try {
- new HashMap(-SIZE_ONE);
+ new HashMap<String, String>(-SIZE_ONE);
} catch (Throwable ex) {
if (ex instanceof IllegalArgumentException) {
failed = false;
@@ -419,7 +421,7 @@
fail("Failure testing new HashMap(-1)");
}
- HashMap zeroSizedHashMap = new HashMap(0);
+ HashMap<String, String> zeroSizedHashMap = new HashMap<String, String>(0);
assertNotNull(zeroSizedHashMap);
}
@@ -427,8 +429,8 @@
* Test method for 'java.util.HashMap.HashMap(int, float)'
*/
public void testHashMapIntFloat() {
-
- HashMap hashMap = new HashMap(CAPACITY_16, LOAD_FACTOR_ONE_HALF);
+ HashMap<String, String> hashMap =
+ new HashMap<String, String>(CAPACITY_16, LOAD_FACTOR_ONE_HALF);
checkEmptyHashMapAssumptions(hashMap);
// TODO(mmendez): how do we verify capacity and load factor?
@@ -436,7 +438,7 @@
// Test new HashMap(-1, 0.0F)
boolean failed = true;
try {
- new HashMap(CAPACITY_NEG_ONE_HALF, LOAD_FACTOR_ZERO);
+ new HashMap<String, String>(CAPACITY_NEG_ONE_HALF, LOAD_FACTOR_ZERO);
} catch (Throwable ex) {
if (ex instanceof IllegalArgumentException) {
failed = false;
@@ -450,7 +452,7 @@
// Test new HashMap(0, -1.0F)
failed = true;
try {
- new HashMap(CAPACITY_ZERO, LOAD_FACTOR_NEG_ONE);
+ new HashMap<String, String>(CAPACITY_ZERO, LOAD_FACTOR_NEG_ONE);
} catch (Throwable ex) {
if (ex instanceof IllegalArgumentException) {
failed = false;
@@ -462,7 +464,7 @@
}
// Test new HashMap(0,0F);
- hashMap = new HashMap(CAPACITY_ZERO, LOAD_FACTOR_ONE_TENTH);
+ hashMap = new HashMap<String, String>(CAPACITY_ZERO, LOAD_FACTOR_ONE_TENTH);
assertNotNull(hashMap);
}
@@ -470,7 +472,7 @@
* Test method for 'java.util.HashMap.HashMap(Map)'
*/
public void testHashMapMap() {
- HashMap srcMap = new HashMap();
+ HashMap<Integer, Integer> srcMap = new HashMap<Integer, Integer>();
assertNotNull(srcMap);
checkEmptyHashMapAssumptions(srcMap);
@@ -478,16 +480,16 @@
srcMap.put(INTEGER_2, INTEGER_22);
srcMap.put(INTEGER_3, INTEGER_33);
- HashMap hashMap = new HashMap(srcMap);
+ HashMap<Integer, Integer> hashMap = new HashMap<Integer, Integer>(srcMap);
assertFalse(hashMap.isEmpty());
assertTrue(hashMap.size() == SIZE_THREE);
- Collection valColl = hashMap.values();
+ Collection<Integer> valColl = hashMap.values();
assertTrue(valColl.contains(INTEGER_11));
assertTrue(valColl.contains(INTEGER_22));
assertTrue(valColl.contains(INTEGER_33));
- Collection keyColl = hashMap.keySet();
+ Collection<Integer> keyColl = hashMap.keySet();
assertTrue(keyColl.contains(INTEGER_1));
assertTrue(keyColl.contains(INTEGER_2));
assertTrue(keyColl.contains(INTEGER_3));
@@ -497,10 +499,10 @@
* Test method for 'java.util.AbstractMap.isEmpty()'
*/
public void testIsEmpty() {
- HashMap srcMap = new HashMap();
+ HashMap<String, String> srcMap = new HashMap<String, String>();
checkEmptyHashMapAssumptions(srcMap);
- HashMap dstMap = new HashMap();
+ HashMap<String, String> dstMap = new HashMap<String, String>();
checkEmptyHashMapAssumptions(dstMap);
dstMap.putAll(srcMap);
@@ -515,7 +517,7 @@
}
public void testKeysConflict() {
- HashMap hashMap = new HashMap();
+ HashMap<Object, String> hashMap = new HashMap<Object, String>();
hashMap.put(STRING_ZERO_KEY, STRING_ZERO_VALUE);
hashMap.put(INTEGER_ZERO_KEY, INTEGER_ZERO_VALUE);
@@ -542,10 +544,10 @@
* Test method for 'java.util.HashMap.keySet()'
*/
public void testKeySet() {
- HashMap hashMap = new HashMap();
+ HashMap<String, String> hashMap = new HashMap<String, String>();
checkEmptyHashMapAssumptions(hashMap);
- Set keySet = hashMap.keySet();
+ Set<String> keySet = hashMap.keySet();
assertNotNull(keySet);
assertTrue(keySet.isEmpty());
assertTrue(keySet.size() == 0);
@@ -589,7 +591,7 @@
* Test method for 'java.util.HashMap.put(Object, Object)'
*/
public void testPut() {
- HashMap hashMap = new HashMap();
+ HashMap<String, String> hashMap = new HashMap<String, String>();
checkEmptyHashMapAssumptions(hashMap);
assertNull(hashMap.put(KEY_TEST_PUT, VALUE_TEST_PUT_1));
@@ -602,7 +604,7 @@
* Test method for 'java.util.HashMap.putAll(Map)'.
*/
public void testPutAll() {
- HashMap srcMap = new HashMap();
+ HashMap<String, String> srcMap = new HashMap<String, String>();
checkEmptyHashMapAssumptions(srcMap);
srcMap.put(KEY_1, VALUE_1);
@@ -610,7 +612,7 @@
srcMap.put(KEY_3, VALUE_3);
// Make sure that the data is copied correctly
- HashMap dstMap = new HashMap();
+ HashMap<String, String> dstMap = new HashMap<String, String>();
checkEmptyHashMapAssumptions(dstMap);
dstMap.putAll(srcMap);
@@ -632,7 +634,7 @@
// Check that an empty map does not blow away the contents of the
// destination map
- HashMap emptyMap = new HashMap();
+ HashMap<String, String> emptyMap = new HashMap<String, String>();
checkEmptyHashMapAssumptions(emptyMap);
dstMap.putAll(emptyMap);
assertTrue(dstMap.size() == srcMap.size());
@@ -667,7 +669,7 @@
* Test method for 'java.util.HashMap.remove(Object)'.
*/
public void testRemove() {
- HashMap hashMap = new HashMap();
+ HashMap<String, String> hashMap = new HashMap<String, String>();
checkEmptyHashMapAssumptions(hashMap);
assertNull(hashMap.remove(null));
@@ -683,7 +685,7 @@
* Test method for 'java.util.HashMap.size()'.
*/
public void testSize() {
- HashMap hashMap = new HashMap();
+ HashMap<String, String> hashMap = new HashMap<String, String>();
checkEmptyHashMapAssumptions(hashMap);
// Test size behavior on put
@@ -707,7 +709,7 @@
hashMap.put(KEY_1, VALUE_1);
hashMap.put(KEY_2, VALUE_2);
hashMap.put(KEY_3, VALUE_3);
- HashMap srcMap = new HashMap(hashMap);
+ HashMap<String, String> srcMap = new HashMap<String, String>(hashMap);
hashMap.putAll(srcMap);
assertEquals(hashMap.size(), SIZE_THREE);
@@ -720,7 +722,7 @@
* Test method for 'java.util.AbstractMap.toString()'.
*/
public void testToString() {
- HashMap hashMap = new HashMap();
+ HashMap<String, String> hashMap = new HashMap<String, String>();
checkEmptyHashMapAssumptions(hashMap);
hashMap.put(KEY_KEY, VALUE_VAL);
String entryString = makeEntryString(KEY_KEY, VALUE_VAL);
@@ -731,33 +733,33 @@
* Test method for 'java.util.AbstractMap.values()'.
*/
public void testValues() {
- HashMap hashMap = new HashMap();
+ HashMap<String, String> hashMap = new HashMap<String, String>();
checkEmptyHashMapAssumptions(hashMap);
assertNotNull(hashMap.values());
hashMap.put(KEY_KEY, VALUE_VAL);
- Collection valColl = hashMap.values();
+ Collection<String> valColl = hashMap.values();
assertNotNull(valColl);
assertEquals(valColl.size(), SIZE_ONE);
- Iterator itVal = valColl.iterator();
- String val = (String) itVal.next();
+ Iterator<String> itVal = valColl.iterator();
+ String val = itVal.next();
assertEquals(val, VALUE_VAL);
}
+ @SuppressWarnings("rawtypes")
@Override
protected Map makeEmptyMap() {
return new HashMap();
}
- private Iterator iterateThrough(final HashMap expected) {
- Iterator iter = expected.entrySet().iterator();
+ private void iterateThrough(final HashMap<?, ?> expected) {
+ Iterator<?> iter = expected.entrySet().iterator();
for (int i = 0; i < expected.size(); i++) {
iter.next();
}
- return iter;
}
private String makeEntryString(final String key, final String value) {
diff --git a/user/test/com/google/gwt/emultest/java/util/HashSetTest.java b/user/test/com/google/gwt/emultest/java/util/HashSetTest.java
index 65c7e5a..0a0b793 100644
--- a/user/test/com/google/gwt/emultest/java/util/HashSetTest.java
+++ b/user/test/com/google/gwt/emultest/java/util/HashSetTest.java
@@ -32,21 +32,23 @@
}
public void testAddingKeys() {
- Map map = new HashMap();
- Set keys = new HashSet(map.keySet());
+ Map<Object, Object> map = new HashMap<Object, Object>();
+ Set<Object> keys = new HashSet<Object>(map.keySet());
keys.add(new Object()); // Throws exception in IE6 (web-mode) but not GWT
}
public void testAddWatch() {
- HashSet s = new HashSet();
+ HashSet<String> s = new HashSet<String>();
s.add("watch");
assertTrue(s.contains("watch"));
}
+ @SuppressWarnings("rawtypes")
protected Set makeEmptySet() {
return new HashSet();
}
+ @SuppressWarnings("rawtypes")
public Object makeObject() {
return new HashSet();
}
diff --git a/user/test/com/google/gwt/emultest/java/util/IdentityHashMapTest.java b/user/test/com/google/gwt/emultest/java/util/IdentityHashMapTest.java
index cea9f19..4ad811a 100644
--- a/user/test/com/google/gwt/emultest/java/util/IdentityHashMapTest.java
+++ b/user/test/com/google/gwt/emultest/java/util/IdentityHashMapTest.java
@@ -24,12 +24,13 @@
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.Map;
-import java.util.Set;
import java.util.Map.Entry;
+import java.util.Set;
/**
* Tests <code>IdentityHashMap</code>.
*/
+@SuppressWarnings({"unchecked", "rawtypes"})
public class IdentityHashMapTest extends TestMap {
/**
@@ -49,8 +50,6 @@
}
private static final int CAPACITY_16 = 16;
- private static final int CAPACITY_NEG_ONE_HALF = -1;
- private static final int CAPACITY_ZERO = 0;
private static final Integer INTEGER_1 = new Integer(1);
private static final Integer INTEGER_11 = new Integer(11);
private static final Integer INTEGER_2 = new Integer(2);
@@ -71,10 +70,6 @@
private static final String KEY_TEST_KEY_SET = "testKeySet";
private static final String KEY_TEST_PUT = "testPut";
private static final String KEY_TEST_REMOVE = "testRemove";
- private static final float LOAD_FACTOR_NEG_ONE = -1.0F;
- private static final float LOAD_FACTOR_ONE_HALF = 0.5F;
- private static final float LOAD_FACTOR_ONE_TENTH = 0.1F;
- private static final float LOAD_FACTOR_ZERO = 0.0F;
private static final Object ODD_ZERO_KEY = new Object() {
public int hashCode() {
return 0;
diff --git a/user/test/com/google/gwt/emultest/java/util/LinkedHashMapTest.java b/user/test/com/google/gwt/emultest/java/util/LinkedHashMapTest.java
index ed8c804..1d06fd5 100644
--- a/user/test/com/google/gwt/emultest/java/util/LinkedHashMapTest.java
+++ b/user/test/com/google/gwt/emultest/java/util/LinkedHashMapTest.java
@@ -21,10 +21,10 @@
import java.util.Collection;
import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
/**
* Tests <code>LinkedHashMap</code>.
@@ -119,8 +119,7 @@
*
* @param hashMap
*/
- @SuppressWarnings("unchecked") // raw LinkedHashMap
- private static void checkEmptyLinkedHashMapAssumptions(LinkedHashMap hashMap) {
+ private static void checkEmptyLinkedHashMapAssumptions(LinkedHashMap<?, ?> hashMap) {
assertNotNull(hashMap);
assertTrue(hashMap.isEmpty());
@@ -754,12 +753,11 @@
* @param hashMap the LinkedHashMap to be copied
* @return the copy
*/
- @SuppressWarnings("unchecked") // raw LinkedHashMap
- private LinkedHashMap cloneLinkedHashMap(LinkedHashMap hashMap) {
+ private <K, V> LinkedHashMap<K, V> cloneLinkedHashMap(LinkedHashMap<K, V> hashMap) {
if (GWT.isScript()) {
- return new LinkedHashMap(hashMap);
+ return new LinkedHashMap<K, V>(hashMap);
} else {
- LinkedHashMap m = new LinkedHashMap();
+ LinkedHashMap<K, V> m = new LinkedHashMap<K, V>();
m.putAll(hashMap);
return m;
}
diff --git a/user/test/com/google/gwt/emultest/java/util/StackProfile.java b/user/test/com/google/gwt/emultest/java/util/StackProfile.java
index fa941c9..e755168 100644
--- a/user/test/com/google/gwt/emultest/java/util/StackProfile.java
+++ b/user/test/com/google/gwt/emultest/java/util/StackProfile.java
@@ -45,7 +45,7 @@
}
public void addTiming(int num) {
- Stack s = new Stack();
+ Stack<String> s = new Stack<String>();
resetTimer();
for (int i = 0; i < num; i++) {
s.push("item" + i);
diff --git a/user/test/com/google/gwt/emultest/java/util/StackTest.java b/user/test/com/google/gwt/emultest/java/util/StackTest.java
index 28e3930..bcc1070 100644
--- a/user/test/com/google/gwt/emultest/java/util/StackTest.java
+++ b/user/test/com/google/gwt/emultest/java/util/StackTest.java
@@ -25,12 +25,129 @@
*/
public class StackTest extends GWTTestCase {
- public static final int TEST_SEARCH_SIZE = 10;
- public static final int TEST_SIZE = 10;
- public static Stack testStack = new Stack();
+ private static final int TEST_SEARCH_SIZE = 10;
+ private static final int TEST_SIZE = 10;
+
+ /** Sets module name so that javascript compiler can operate. */
+ public String getModuleName() {
+ return "com.google.gwt.emultest.EmulSuite";
+ }
+
+ /** Tests clone on Stacks. */
+ public void testClone() {
+ Stack<Integer> large = createLargeStack();
+ @SuppressWarnings("unchecked")
+ Stack<Integer> cloned = (Stack<Integer>) large.clone();
+ checkLargeStack(cloned, 0);
+ assertEquals(large.size(), TEST_SIZE);
+ }
+
+ /**
+ * Tests pushing many elements into a stack, and seeing if they come out in
+ * order. Also verifies that we get the correct exception when we run out of
+ * elements, and tests peek
+ */
+ public void testCountAndOrderWithPeek() {
+ Stack<Integer> large = new Stack<Integer>();
+ for (int i = 0; i < TEST_SIZE; i++) {
+ large.push(i);
+ assertTrue(large.peek() == i);
+ assertTrue(large.pop() == i);
+ int theFinalInt = i + TEST_SIZE;
+ large.push(theFinalInt);
+ assertTrue(large.peek() == theFinalInt);
+ }
+ checkLargeStack(large, TEST_SIZE);
+ }
+
+ /** tests empty and tries to get emptyStackException as desired. */
+ public void testEmptyAndEmptyStackException() {
+ Stack<String> s = new Stack<String>();
+ String item = "empty1";
+ s.push(item);
+ assertEquals(1, s.size());
+ assertFalse(s.empty());
+ assertEquals(s.pop(), item);
+ checkEmptiness(s);
+ }
+
+ /** Tests pop and peek. */
+ public void testPopAndPeek() {
+ Stack<String> testStack = createStack();
+ int x = testStack.size();
+ Object item = testStack.peek();
+ assertTrue(testStack.pop() == item);
+ assertEquals(x - 1, testStack.size());
+ }
+
+ /** Tests push and peek. */
+ public void testPushAndPeek() {
+ Stack<String> testStack = createStack();
+ int x = testStack.size();
+ String item = "4";
+ testStack.push(item);
+ assertEquals(x + 1, testStack.size());
+ assertTrue(testStack.peek() == item);
+ }
+
+ /**
+ * Tests all combinations of search for a stack that attains a max size of
+ * TEST_SEARCH_SIZE.
+ */
+ public void testSearch() {
+ Stack<Integer> searchStack = new Stack<Integer>();
+ checkEmptiness(searchStack);
+ for (int stackSizeIncreasing = 0; stackSizeIncreasing < TEST_SEARCH_SIZE;
+ stackSizeIncreasing++) {
+ for (int theInt = 0; theInt < stackSizeIncreasing; theInt++) {
+ assertEquals(
+ "Increasing search found", searchStack.search(theInt), searchStack.size() - theInt);
+ }
+ for (int theInt = stackSizeIncreasing; theInt < TEST_SEARCH_SIZE; theInt++) {
+ assertEquals("Increasing not found", searchStack.search(theInt), -1);
+ }
+ searchStack.push(stackSizeIncreasing);
+ }
+ for (int stackSizeDecreasing = TEST_SEARCH_SIZE - 1; stackSizeDecreasing >= 0;
+ stackSizeDecreasing--) {
+ for (int theInt = TEST_SEARCH_SIZE - 1; theInt > stackSizeDecreasing; theInt--) {
+ assertEquals("Search decreasing not found", searchStack.search(theInt), -1);
+ }
+ for (int theInt = stackSizeDecreasing; theInt >= 0; theInt--) {
+ assertEquals(
+ "Search decreasing found", searchStack.search(theInt), searchStack.size() - theInt);
+ }
+ searchStack.pop();
+ }
+ checkEmptiness(searchStack);
+ }
+
+ private void checkLargeStack(Stack<Integer> stack, int offset) {
+ for (int i = TEST_SIZE - 1; i >= 0; i--) {
+ int theObtainedInt = stack.pop();
+ assertEquals(i + offset, theObtainedInt);
+ }
+ checkEmptiness(stack);
+ }
+
+ private Stack<Integer> createLargeStack() {
+ Stack<Integer> large = new Stack<Integer>();
+ for (int i = 0; i < TEST_SIZE; i++) {
+ large.push(i);
+ }
+ return large;
+ }
+
+ private Stack<String> createStack() {
+ Stack<String> stack = new Stack<String>();
+ stack.push("1");
+ stack.push("2");
+ stack.push("3");
+ return stack;
+ }
/** Checks for emptiness of stack by peeking and popping. */
- public void checkEmptiness(Stack s) {
+ private void checkEmptiness(Stack<?> s) {
assertTrue(s.empty());
try {
s.pop();
@@ -44,120 +161,4 @@
}
}
}
-
- /** Sets module name so that javascript compiler can operate. */
- public String getModuleName() {
- return "com.google.gwt.emultest.EmulSuite";
- }
-
- /** Tests clone on Stacks. */
- public void testClone() {
- Stack large = createLargeStack();
- Stack cloned = (Stack) large.clone();
- checkLargeStack(cloned, 0);
- assertEquals(large.size(), TEST_SIZE);
- }
-
- /**
- * Tests pushing many elements into a stack, and seeing if they come out in
- * order. Also verifies that we get the correct exception when we run out of
- * elements, and tests peek
- */
- public void testCountAndOrderWithPeek() {
- Stack large = new Stack();
- for (int i = 0; i < TEST_SIZE; i++) {
- Integer theInt = new Integer(i);
- large.push(theInt);
- assertTrue(large.peek() == theInt);
- assertTrue(large.pop() == theInt);
- Integer theFinalInt = new Integer(theInt.intValue() + TEST_SIZE);
- large.push(theFinalInt);
- assertTrue(large.peek() == theFinalInt);
- }
- checkLargeStack(large, TEST_SIZE);
- }
-
- /** tests empty and tries to get emptyStackException as desired. */
- public void testEmptyAndEmptyStackException() {
- Stack s = new Stack();
- String item = "empty1";
- s.push(item);
- assertEquals(1, s.size());
- assertFalse(s.empty());
- assertEquals(s.pop(), item);
- checkEmptiness(s);
- }
-
- /** Tests pop and peek. */
- public void testPopAndPeek() {
- int x = testStack.size();
- Object item = testStack.peek();
- assertTrue(testStack.pop() == item);
- assertEquals(x - 1, testStack.size());
- }
-
- /** Tests push and peek. */
- public void testPushAndPeek() {
- int x = testStack.size();
- Object item = "4";
- testStack.push(item);
- assertEquals(x + 1, testStack.size());
- assertTrue(testStack.peek() == item);
- }
-
- /**
- * Tests all combinations of search for a stack that attains a max size of
- * TEST_SEARCH_SIZE.
- */
- public void testSearch() {
- Stack searchStack = new Stack();
- checkEmptiness(searchStack);
- for (int stackSizeIncreasing = 0; stackSizeIncreasing < TEST_SEARCH_SIZE; stackSizeIncreasing++) {
- for (int theInt = 0; theInt < stackSizeIncreasing; theInt++) {
- assertEquals("Increasing search found", searchStack.search(new Integer(
- theInt)), searchStack.size() - theInt);
- }
- for (int theInt = stackSizeIncreasing; theInt < TEST_SEARCH_SIZE; theInt++) {
- assertEquals("Increasing not found", searchStack.search(new Integer(
- theInt)), -1);
- }
- searchStack.push(new Integer(stackSizeIncreasing));
- }
- for (int stackSizeDecreasing = TEST_SEARCH_SIZE - 1; stackSizeDecreasing >= 0; stackSizeDecreasing--) {
- for (int theInt = TEST_SEARCH_SIZE - 1; theInt > stackSizeDecreasing; theInt--) {
- assertEquals("Search decreasing not found",
- searchStack.search(new Integer(theInt)), -1);
- }
- for (int theInt = stackSizeDecreasing; theInt >= 0; theInt--) {
- assertEquals("Search decreasing found", searchStack.search(new Integer(
- theInt)), searchStack.size() - theInt);
- }
- searchStack.pop();
- }
- checkEmptiness(searchStack);
- }
-
- private void checkLargeStack(Stack cloned, int offset) {
- for (int i = TEST_SIZE - 1; i >= 0; i--) {
- Integer theObtainedInt = (Integer) cloned.pop();
- assertEquals(i + offset, theObtainedInt.intValue());
- }
- checkEmptiness(cloned);
- }
-
- private Stack createLargeStack() {
- Stack large = new Stack();
- for (int i = 0; i < TEST_SIZE; i++) {
- Integer theFinalInt = new Integer(i);
- large.push(theFinalInt);
- }
- return large;
- }
-
- static {
- testStack.push("1");
- testStack.push("2");
- testStack.push("3");
- }
-
}
diff --git a/user/test/com/google/gwt/emultest/java/util/TreeMapTest.java b/user/test/com/google/gwt/emultest/java/util/TreeMapTest.java
index 30ea28e..59a5f66 100644
--- a/user/test/com/google/gwt/emultest/java/util/TreeMapTest.java
+++ b/user/test/com/google/gwt/emultest/java/util/TreeMapTest.java
@@ -29,11 +29,11 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
-import java.util.Map.Entry;
/**
* Tests <code>TreeMap</code>.
@@ -943,6 +943,7 @@
assertEquals(1, keySet.size());
}
+ @SuppressWarnings("unchecked")
public void testKeySetIteratorRemove() {
Map<K, V> map = makeFullMap();
resetFull();
@@ -1541,6 +1542,7 @@
*
* @see java.util.Map#remove(Object)
*/
+ @SuppressWarnings("unchecked")
public void testRemove_throwsNullPointerException() {
// The _throwsUnsupportedOperationException version of this test will
// verify that the method is not supported.
diff --git a/user/test/com/google/gwt/i18n/MapTestBase.java b/user/test/com/google/gwt/i18n/MapTestBase.java
index 2901dd2..475a3e4 100644
--- a/user/test/com/google/gwt/i18n/MapTestBase.java
+++ b/user/test/com/google/gwt/i18n/MapTestBase.java
@@ -106,6 +106,7 @@
* @author Paul Jack
* @version $Id: TestMap.java,v 1.20.2.1 2004/05/22 12:14:05 scolebourne Exp $
*/
+@SuppressWarnings({"unchecked", "rawtypes"})
public abstract class MapTestBase extends TestCase {
// These instance variables are initialized with the reset method.
diff --git a/user/test/com/google/gwt/uibinder/attributeparsers/StrictAttributeParserTest.java b/user/test/com/google/gwt/uibinder/attributeparsers/StrictAttributeParserTest.java
index f8ec5e2..81af5a1 100644
--- a/user/test/com/google/gwt/uibinder/attributeparsers/StrictAttributeParserTest.java
+++ b/user/test/com/google/gwt/uibinder/attributeparsers/StrictAttributeParserTest.java
@@ -31,13 +31,13 @@
public void testSimple() {
String before = "{able.baker.charlie.prawns}";
String expected = "able.baker().charlie().prawns()";
- assertEquals(expected, converter.convert(before, new FieldReferenceDelegate(null)));
+ assertEquals(expected, converter.convert(before, new FieldReferenceDelegate()));
}
public void testNoneShouldFail() {
String before = "able.baker.charlie.prawns";
try {
- converter.convert(before, new FieldReferenceDelegate(null));
+ converter.convert(before, new FieldReferenceDelegate());
fail();
} catch (IllegalFieldReferenceException e) {
/* pass */
@@ -47,7 +47,7 @@
public void testTooManyShouldFail() {
String before = "{able.baker.charlie} {prawns.are.yummy}";
try {
- converter.convert(before, new FieldReferenceDelegate(null));
+ converter.convert(before, new FieldReferenceDelegate());
fail();
} catch (IllegalFieldReferenceException e) {
/* pass */
@@ -57,7 +57,7 @@
public void testMixedShouldFail() {
String before = "{able.baker.charlie} prawns are still yummy}";
try {
- converter.convert(before, new FieldReferenceDelegate(null));
+ converter.convert(before, new FieldReferenceDelegate());
fail();
} catch (IllegalFieldReferenceException e) {
/* pass */
diff --git a/user/test/com/google/gwt/user/client/rpc/RecursiveClassTest.java b/user/test/com/google/gwt/user/client/rpc/RecursiveClassTest.java
index e3b84df..f241687 100644
--- a/user/test/com/google/gwt/user/client/rpc/RecursiveClassTest.java
+++ b/user/test/com/google/gwt/user/client/rpc/RecursiveClassTest.java
@@ -15,8 +15,8 @@
*/
package com.google.gwt.user.client.rpc;
-import com.google.gwt.user.client.rpc.RecursiveClassTestService.ResultNode;
import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.rpc.RecursiveClassTestService.ResultNode;
/**
* Class used to test generics with wild cards and recursive references.
@@ -26,18 +26,19 @@
/**
* This method is used to test generics with wild cards and recursive references.
*/
+ @SuppressWarnings({"unchecked", "rawtypes"})
public void testRecursiveClass() {
RecursiveClassTestServiceAsync service = getServiceAsync();
delayTestFinishForRpc();
- service.greetServer("Hello", new AsyncCallback<ResultNode>() {
+ service.greetServer("Hello", new AsyncCallback() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
}
- public void onSuccess(ResultNode result) {
+ public void onSuccess(Object result) {
assertNotNull(result);
- assertTrue(TestSetValidator.isValidRecurisveClassObject(result));
+ assertTrue(result instanceof ResultNode);
finishTest();
}
});
diff --git a/user/test/com/google/gwt/user/client/rpc/RecursiveClassTestServiceAsync.java b/user/test/com/google/gwt/user/client/rpc/RecursiveClassTestServiceAsync.java
index 61fd819..6436f45 100644
--- a/user/test/com/google/gwt/user/client/rpc/RecursiveClassTestServiceAsync.java
+++ b/user/test/com/google/gwt/user/client/rpc/RecursiveClassTestServiceAsync.java
@@ -21,6 +21,6 @@
* Service used to test generics with wild cards and recursive references.
*/
public interface RecursiveClassTestServiceAsync {
- <U extends ResultNode<?>> void greetServer(String input, AsyncCallback<ResultNode> callback)
- throws IllegalArgumentException;
+ <U extends ResultNode<U>> void greetServer(String input, AsyncCallback<ResultNode<U>> callback)
+ throws IllegalArgumentException;
}
diff --git a/user/test/com/google/gwt/user/client/rpc/TestSetValidator.java b/user/test/com/google/gwt/user/client/rpc/TestSetValidator.java
index f5601b0..76fb619 100644
--- a/user/test/com/google/gwt/user/client/rpc/TestSetValidator.java
+++ b/user/test/com/google/gwt/user/client/rpc/TestSetValidator.java
@@ -31,7 +31,6 @@
import com.google.gwt.user.client.rpc.TestSetFactory.SerializableGraphWithCFS;
import com.google.gwt.user.client.rpc.TestSetFactory.SerializablePrivateNoArg;
import com.google.gwt.user.client.rpc.TestSetFactory.SerializableWithTwoArrays;
-import com.google.gwt.user.client.rpc.RecursiveClassTestService.ResultNode;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
@@ -39,9 +38,9 @@
import static junit.framework.Assert.assertSame;
import java.util.ArrayList;
+import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.EnumMap;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
@@ -49,11 +48,11 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.Vector;
-import java.util.Map.Entry;
/**
* Misnamed set of static validation methods used by various collection class
@@ -806,10 +805,6 @@
return true;
}
- public static boolean isValidRecurisveClassObject(ResultNode<? extends ResultNode<?>> result) {
- return (result != null);
- }
-
public static boolean isValidSingletonList(List<MarkerTypeSingleton> list) {
if (list == null || list.size() != 1) {
return false;
diff --git a/user/test/com/google/gwt/user/client/ui/CustomButtonTest.java b/user/test/com/google/gwt/user/client/ui/CustomButtonTest.java
index 6f38b6e..9f0b8e2 100644
--- a/user/test/com/google/gwt/user/client/ui/CustomButtonTest.java
+++ b/user/test/com/google/gwt/user/client/ui/CustomButtonTest.java
@@ -29,9 +29,7 @@
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
-import java.util.Map.Entry;
/**
* Test for <code>PushButton</code> as most of this widget's functionality is UI
@@ -84,29 +82,25 @@
b.setDown(true);
assertEquals(b.getStylePrimaryName(), "random");
- Map faces = new HashMap();
+ Map<String, Face> faces = new HashMap<String, Face>();
faces.put("downDisabled", b.getDownDisabledFace());
faces.put("upDisabled", b.getUpDisabledFace());
faces.put("down", b.getDownFace());
faces.put("up", b.getUpFace());
faces.put("upHovering", b.getUpHoveringFace());
faces.put("downHovering", b.getDownHoveringFace());
- Iterator entries = faces.entrySet().iterator();
// Set all faces as text.
- while (entries.hasNext()) {
- Map.Entry entry = (Entry) entries.next();
- Face f = (Face) entry.getValue();
+ for (Map.Entry<String, Face> entry : faces.entrySet()) {
+ Face f = entry.getValue();
b.setCurrentFace(f);
assertEquals("random", b.getStylePrimaryName());
assertTrue(b.getStyleName().indexOf("random-" + f.getName()) != -1);
}
- entries = faces.entrySet().iterator();
b.addStyleName("fobar");
// Set all faces as text.
- while (entries.hasNext()) {
- Map.Entry entry = (Entry) entries.next();
- Face f = (Face) entry.getValue();
+ for (Map.Entry<String, Face> entry : faces.entrySet()) {
+ Face f = entry.getValue();
b.setCurrentFace(f);
String computedStyleName = DOM.getElementProperty(b.getElement(),
"className");
@@ -118,43 +112,37 @@
public void testSettingFaces() {
PushButton b = new PushButton();
- Map faces = new HashMap();
+ Map<String, Face> faces = new HashMap<String, Face>();
faces.put("downDisabled", b.getDownDisabledFace());
faces.put("upDisabled", b.getUpDisabledFace());
faces.put("down", b.getDownFace());
faces.put("up", b.getUpFace());
faces.put("upHovering", b.getUpHoveringFace());
faces.put("downHovering", b.getDownHoveringFace());
- Iterator entries = faces.entrySet().iterator();
// Set all faces as text.
- while (entries.hasNext()) {
- Map.Entry entry = (Entry) entries.next();
- Face f = (Face) entry.getValue();
- String faceName = (String) entry.getKey();
+ for (Map.Entry<String, Face> entry : faces.entrySet()) {
+ Face f = entry.getValue();
+ String faceName = entry.getKey();
f.setText(faceName);
}
- entries = faces.entrySet().iterator();
- while (entries.hasNext()) {
- Map.Entry entry = (Entry) entries.next();
- Face f = (Face) entry.getValue();
- String faceName = (String) entry.getKey();
+
+ for (Map.Entry<String, Face> entry : faces.entrySet()) {
+ Face f = entry.getValue();
+ String faceName = entry.getKey();
assertEquals(f.getText(), faceName);
}
+
// Set all faces as HTML
- entries = faces.entrySet().iterator();
- while (entries.hasNext()) {
- Map.Entry entry = (Entry) entries.next();
- Face f = (Face) entry.getValue();
- String faceName = (String) entry.getKey();
+ for (Map.Entry<String, Face> entry : faces.entrySet()) {
+ Face f = entry.getValue();
+ String faceName = entry.getKey();
f.setHTML("<b>" + faceName + "</b>");
}
- entries = faces.entrySet().iterator();
- while (entries.hasNext()) {
- Map.Entry entry = (Entry) entries.next();
- Face f = (Face) entry.getValue();
- String faceName = (String) entry.getKey();
+ for (Map.Entry<String, Face> entry : faces.entrySet()) {
+ Face f = entry.getValue();
+ String faceName = entry.getKey();
assertEquals(f.getText(), faceName);
assertEquals(f.getHTML().toLowerCase(), "<b>" + faceName.toLowerCase()
+ "</b>");
diff --git a/user/test/com/google/gwt/user/client/ui/FastStringMapProfile.java b/user/test/com/google/gwt/user/client/ui/FastStringMapProfile.java
index b6057b4..71f50b1 100644
--- a/user/test/com/google/gwt/user/client/ui/FastStringMapProfile.java
+++ b/user/test/com/google/gwt/user/client/ui/FastStringMapProfile.java
@@ -22,7 +22,7 @@
*/
public class FastStringMapProfile extends WidgetProfile {
- Map m;
+ Map<String, Integer> m;
public void testTiming() throws Exception {
m = putTiming(32000);
@@ -46,8 +46,8 @@
this.timing("get(" + size + ")");
}
- public FastStringMap putTiming(int size) {
- FastStringMap m1 = new FastStringMap();
+ public FastStringMap<Integer> putTiming(int size) {
+ FastStringMap<Integer> m1 = new FastStringMap<Integer>();
this.resetTimer();
for (int i = 0; i < size; i++) {
Integer iVal = new Integer(size);
diff --git a/user/test/com/google/gwt/user/client/ui/HTMLTableProfile.java b/user/test/com/google/gwt/user/client/ui/HTMLTableProfile.java
index a033ba7..cc86737 100644
--- a/user/test/com/google/gwt/user/client/ui/HTMLTableProfile.java
+++ b/user/test/com/google/gwt/user/client/ui/HTMLTableProfile.java
@@ -70,7 +70,7 @@
public void hashMapShare(int rows, int columns) {
resetTimer();
- HashMap m = new HashMap();
+ HashMap<String, Label> m = new HashMap<String, Label>();
for (int row = 0; row < rows; row++) {
for (int column = 0; column < columns; column++) {
Label label = new Label(column + "i");
diff --git a/user/test/com/google/gwt/user/client/ui/PrefixTreeTest.java b/user/test/com/google/gwt/user/client/ui/PrefixTreeTest.java
index 7cabdd7..38e8d5e 100644
--- a/user/test/com/google/gwt/user/client/ui/PrefixTreeTest.java
+++ b/user/test/com/google/gwt/user/client/ui/PrefixTreeTest.java
@@ -18,7 +18,6 @@
import com.google.gwt.junit.client.GWTTestCase;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
/**
@@ -126,7 +125,7 @@
* Tests newly constructed prefix tree assumptions.
*/
public void testPlaysWellWithOthers() {
- final List l = new ArrayList();
+ final List<String> l = new ArrayList<String>();
for (int i = 0; i < 100; i++) {
l.add(String.valueOf(i));
}
@@ -168,7 +167,7 @@
testSizeByIterator(tree);
assertTrue(tree.iterator().hasNext());
- List l;
+ List<String> l;
l = tree.getSuggestions("", 13);
assertTrue("Expected size of 13, got " + l.size(), l.size() == 13);
@@ -188,7 +187,7 @@
l = tree.getSuggestions("o", 1);
assertTrue("Expected size of 1, got " + l.size(), l.size() == 1);
- assertTrue(((String) l.get(0)).endsWith("..."));
+ assertTrue(l.get(0).endsWith("..."));
assertAllStartWith(l, "o");
l = tree.getSuggestions("something", 1);
@@ -197,9 +196,8 @@
assertAllStartWith(l, "somethingdifferent");
}
- protected void assertAllStartWith(List l, String prefix) {
- for (final Iterator i = l.iterator(); i.hasNext();) {
- final String test = (String) i.next();
+ protected void assertAllStartWith(List<String> l, String prefix) {
+ for (String test : l) {
assertTrue(test + " does not start with " + prefix,
test.startsWith(prefix));
}
@@ -213,8 +211,7 @@
*/
protected void testSizeByIterator(PrefixTree tree) {
int count = 0;
- for (final Iterator i = tree.iterator(); i.hasNext();) {
- i.next();
+ for (@SuppressWarnings("unused") String s : tree) {
count++;
}
diff --git a/user/test/com/google/gwt/user/client/ui/WidgetCollectionTest.java b/user/test/com/google/gwt/user/client/ui/WidgetCollectionTest.java
index 33d01ad..121b54c 100644
--- a/user/test/com/google/gwt/user/client/ui/WidgetCollectionTest.java
+++ b/user/test/com/google/gwt/user/client/ui/WidgetCollectionTest.java
@@ -38,7 +38,7 @@
public void clear() {
}
- public Iterator iterator() {
+ public Iterator<Widget> iterator() {
return null;
}
@@ -88,7 +88,7 @@
wc.add(l1);
wc.add(l2);
- Iterator it = wc.iterator();
+ Iterator<Widget> it = wc.iterator();
assertTrue(it.hasNext());
assertEquals(it.next(), l0);
it.remove();
diff --git a/user/test/com/google/gwt/user/client/ui/WidgetIteratorsTest.java b/user/test/com/google/gwt/user/client/ui/WidgetIteratorsTest.java
index 21821cf..fe7ffc7 100644
--- a/user/test/com/google/gwt/user/client/ui/WidgetIteratorsTest.java
+++ b/user/test/com/google/gwt/user/client/ui/WidgetIteratorsTest.java
@@ -37,7 +37,7 @@
fail("Unexpected call to clear()");
}
- public Iterator iterator() {
+ public Iterator<Widget> iterator() {
fail("Unexpected call to iterator()");
return null;
}
@@ -56,7 +56,7 @@
* Tests that empty arrays operate properly.
*/
public void testEmptyArray() {
- final Iterator subject = WidgetIterators.createWidgetIterator(
+ final Iterator<Widget> subject = WidgetIterators.createWidgetIterator(
new MockWidget(), new Widget[] {null, null});
assertFalse(subject.hasNext());
assertNextFails(subject);
@@ -80,7 +80,7 @@
}
};
- final Iterator subject = WidgetIterators.createWidgetIterator(mock, widgets);
+ final Iterator<Widget> subject = WidgetIterators.createWidgetIterator(mock, widgets);
expectedRemoveIndex[0] = 1;
assertTrue(subject.hasNext());
@@ -106,7 +106,7 @@
final MockWidget mock = new MockWidget();
final Widget[] widgets = new Widget[] {
null, createTestWidget(), null, createTestWidget(), null, null};
- final Iterator subject = WidgetIterators.createWidgetIterator(mock, widgets);
+ final Iterator<Widget> subject = WidgetIterators.createWidgetIterator(mock, widgets);
assertTrue(subject.hasNext());
assertEquals(widgets[1], subject.next());
@@ -118,7 +118,7 @@
assertNextFails(subject);
}
- private void assertNextFails(Iterator iterator) {
+ private void assertNextFails(Iterator<Widget> iterator) {
try {
iterator.next();
fail("Expected NoSuchElementException.");
@@ -127,7 +127,7 @@
}
}
- private void assertRemoveFails(Iterator iterator) {
+ private void assertRemoveFails(Iterator<Widget> iterator) {
try {
iterator.remove();
fail("Expected IllegalStateException.");
diff --git a/user/test/com/google/gwt/user/server/rpc/impl/StandardSerializationPolicyTest.java b/user/test/com/google/gwt/user/server/rpc/impl/StandardSerializationPolicyTest.java
index 90bb1be..f75f54d 100644
--- a/user/test/com/google/gwt/user/server/rpc/impl/StandardSerializationPolicyTest.java
+++ b/user/test/com/google/gwt/user/server/rpc/impl/StandardSerializationPolicyTest.java
@@ -21,6 +21,7 @@
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
/**
* Tests for the {@link StandardSerializationPolicy} class.
@@ -117,14 +118,14 @@
}
StandardSerializationPolicy getStandardSerializationPolicy() {
- Map map = new HashMap();
+ Map<Class<?>, Boolean> map = new HashMap<Class<?>, Boolean>();
map.put(A.class, Boolean.TRUE);
map.put(C.class, Boolean.FALSE);
- Map typeIds = new HashMap();
+ Map<Class<?>, String> typeIds = new HashMap<Class<?>, String>();
typeIds.put(A.class, "A");
typeIds.put(B.class, "B");
- return new StandardSerializationPolicy(map, map, typeIds, new HashMap());
+ return new StandardSerializationPolicy(map, map, typeIds, new HashMap<Class<?>, Set<String>>());
}
}
diff --git a/user/test/com/google/gwt/validation/example/client/AuthorTest.java b/user/test/com/google/gwt/validation/example/client/AuthorTest.java
index 374399d..38d4d1b 100644
--- a/user/test/com/google/gwt/validation/example/client/AuthorTest.java
+++ b/user/test/com/google/gwt/validation/example/client/AuthorTest.java
@@ -47,20 +47,20 @@
initValidAuthor();
Set<ConstraintViolation<Author>> violations = validator.validate(author,
ClientGroup.class);
- assertContentsAnyOrder("valid author", violations);
+ assertContentsEmpty("valid author", violations);
}
public void testGroup_default() throws Exception {
initValidAuthor();
Set<ConstraintViolation<Author>> violations = validator.validate(author,
Default.class);
- assertContentsAnyOrder("valid author", violations);
+ assertContentsEmpty("valid author", violations);
}
public void testGroup_empty() throws Exception {
initValidAuthor();
Set<ConstraintViolation<Author>> violations = validator.validate(author);
- assertContentsAnyOrder("valid author", violations);
+ assertContentsEmpty("valid author", violations);
}
public void testGroup_serverGroup() throws Exception {
@@ -93,7 +93,7 @@
public void testValidate_valid() {
initValidAuthor();
Set<ConstraintViolation<Author>> violations = validator.validate(author);
- assertContentsAnyOrder("valid author", violations);
+ assertContentsEmpty("valid author", violations);
}
public void testValidateProperty_object() {
@@ -125,6 +125,11 @@
author.setCompany("Google");
}
+ private <T> void assertContentsEmpty(String message,
+ Iterable<T> actual) {
+ assertFalse(message + "Expected empty but found " + actual, actual.iterator().hasNext());
+ }
+
private <T> void assertContentsAnyOrder(String message,
Iterable<T> actual, T... expected) {
diff --git a/user/test/com/google/web/bindery/requestfactory/shared/impl/RequestPayloadTest.java b/user/test/com/google/web/bindery/requestfactory/shared/impl/RequestPayloadTest.java
index d40d9a0..e2c33cf 100644
--- a/user/test/com/google/web/bindery/requestfactory/shared/impl/RequestPayloadTest.java
+++ b/user/test/com/google/web/bindery/requestfactory/shared/impl/RequestPayloadTest.java
@@ -119,6 +119,7 @@
for (OperationMessage operationMessage : requestMessage.getOperations()) {
if (fooTypeToken.equals(operationMessage.getTypeToken())) {
seenFoos++;
+ @SuppressWarnings("unchecked")
SimpleProxyId<?> id = (SimpleProxyId<?>) foo.stableId();
assertEquals(id.getServerId(), operationMessage.getServerId());
assertEquals(2, operationMessage.getPropertyMap().size());
diff --git a/user/test/org/apache/commons/collections/AbstractTestListIterator.java b/user/test/org/apache/commons/collections/AbstractTestListIterator.java
index 24701f5..e97f743 100755
--- a/user/test/org/apache/commons/collections/AbstractTestListIterator.java
+++ b/user/test/org/apache/commons/collections/AbstractTestListIterator.java
@@ -37,6 +37,7 @@
* @author Rodney Waldhoff
* @author Stephen Colebourne
*/
+@SuppressWarnings({"unchecked", "rawtypes"})
public abstract class AbstractTestListIterator extends TestIterator {
// -----------------------------------------------------------------------
diff --git a/user/test/org/apache/commons/collections/DefaultMapEntry.java b/user/test/org/apache/commons/collections/DefaultMapEntry.java
index 1b15f06..2f8ee5a 100644
--- a/user/test/org/apache/commons/collections/DefaultMapEntry.java
+++ b/user/test/org/apache/commons/collections/DefaultMapEntry.java
@@ -23,7 +23,7 @@
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
* @author <a href="mailto:mas@apache.org">Michael A. Smith</a>
*/
-
+@SuppressWarnings({"unchecked", "rawtypes"})
public class DefaultMapEntry implements Map.Entry {
private Object key;
diff --git a/user/test/org/apache/commons/collections/LocalTestNode.java b/user/test/org/apache/commons/collections/LocalTestNode.java
index 5608b62..ba282ad 100644
--- a/user/test/org/apache/commons/collections/LocalTestNode.java
+++ b/user/test/org/apache/commons/collections/LocalTestNode.java
@@ -22,6 +22,7 @@
*
* @author Marc Johnson (marcj at users dot sourceforge dot net)
*/
+@SuppressWarnings({"unchecked", "rawtypes"})
class LocalTestNode implements Comparable {
private Comparable key;
diff --git a/user/test/org/apache/commons/collections/TestArrayList.java b/user/test/org/apache/commons/collections/TestArrayList.java
index 07ff0ab..63ef8b3 100644
--- a/user/test/org/apache/commons/collections/TestArrayList.java
+++ b/user/test/org/apache/commons/collections/TestArrayList.java
@@ -21,6 +21,7 @@
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
* @version $Id: TestArrayList.java,v 1.5.2.1 2004/05/22 12:14:05 scolebourne Exp $
*/
+@SuppressWarnings({"unchecked", "rawtypes"})
public abstract class TestArrayList extends TestList
{
diff --git a/user/test/org/apache/commons/collections/TestCollection.java b/user/test/org/apache/commons/collections/TestCollection.java
index e3aac53..66d187f 100644
--- a/user/test/org/apache/commons/collections/TestCollection.java
+++ b/user/test/org/apache/commons/collections/TestCollection.java
@@ -110,6 +110,7 @@
* @author <a href="mailto:mas@apache.org">Michael A. Smith</a>
* @version $Id: TestCollection.java,v 1.9.2.1 2004/05/22 12:14:05 scolebourne Exp $
*/
+@SuppressWarnings({"unchecked", "rawtypes"})
public abstract class TestCollection extends TestObject {
//
diff --git a/user/test/org/apache/commons/collections/TestComparator.java b/user/test/org/apache/commons/collections/TestComparator.java
index 488dd6a..331644d 100644
--- a/user/test/org/apache/commons/collections/TestComparator.java
+++ b/user/test/org/apache/commons/collections/TestComparator.java
@@ -20,7 +20,7 @@
import java.util.Comparator;
import java.util.List;
-
+@SuppressWarnings({"unchecked", "rawtypes"})
public abstract class TestComparator extends TestObject {
diff --git a/user/test/org/apache/commons/collections/TestIterator.java b/user/test/org/apache/commons/collections/TestIterator.java
index 9b779da..4714bc1 100644
--- a/user/test/org/apache/commons/collections/TestIterator.java
+++ b/user/test/org/apache/commons/collections/TestIterator.java
@@ -23,6 +23,7 @@
*
* @author Morgan Delagrange
*/
+@SuppressWarnings({"unchecked", "rawtypes"})
public abstract class TestIterator extends TestObject {
diff --git a/user/test/org/apache/commons/collections/TestList.java b/user/test/org/apache/commons/collections/TestList.java
index 9a0135b..88dd29c 100644
--- a/user/test/org/apache/commons/collections/TestList.java
+++ b/user/test/org/apache/commons/collections/TestList.java
@@ -40,6 +40,7 @@
* @author Paul Jack
* @version $Id: TestList.java,v 1.13.2.1 2004/05/22 12:14:05 scolebourne Exp $
*/
+@SuppressWarnings({"unchecked", "rawtypes"})
public abstract class TestList extends TestCollection {
diff --git a/user/test/org/apache/commons/collections/TestMap.java b/user/test/org/apache/commons/collections/TestMap.java
index 16e39ce..7e1d0a9 100644
--- a/user/test/org/apache/commons/collections/TestMap.java
+++ b/user/test/org/apache/commons/collections/TestMap.java
@@ -106,6 +106,7 @@
* @author Paul Jack
* @version $Id: TestMap.java,v 1.20.2.1 2004/05/22 12:14:05 scolebourne Exp $
*/
+@SuppressWarnings({"unchecked", "rawtypes"})
public abstract class TestMap extends TestObject{
// These instance variables are initialized with the reset method.
diff --git a/user/test/org/apache/commons/collections/TestSet.java b/user/test/org/apache/commons/collections/TestSet.java
index 14f9933..df77884 100644
--- a/user/test/org/apache/commons/collections/TestSet.java
+++ b/user/test/org/apache/commons/collections/TestSet.java
@@ -38,6 +38,7 @@
* @author Paul Jack
* @version $Id: TestSet.java,v 1.2.2.1 2004/05/22 12:14:05 scolebourne Exp $
*/
+@SuppressWarnings({"unchecked", "rawtypes"})
public abstract class TestSet extends TestCollection {
diff --git a/user/test/org/hibernate/jsr303/tck/util/TckTestSuiteWrapper.java b/user/test/org/hibernate/jsr303/tck/util/TckTestSuiteWrapper.java
index e58710e..d0509ed 100644
--- a/user/test/org/hibernate/jsr303/tck/util/TckTestSuiteWrapper.java
+++ b/user/test/org/hibernate/jsr303/tck/util/TckTestSuiteWrapper.java
@@ -25,7 +25,6 @@
import com.google.gwt.thirdparty.guava.common.base.Predicate;
import junit.framework.Test;
-import junit.framework.TestCase;
import org.hibernate.jsr303.tck.util.client.Failing;
import org.hibernate.jsr303.tck.util.client.NonTckTest;
@@ -107,8 +106,8 @@
return;
}
- Class superClass = theClass;
- Vector names = new Vector();
+ Class<?> superClass = theClass;
+ Vector<String> names = new Vector<String>();
while (Test.class.isAssignableFrom(superClass)) {
for (Method method : filter(copyOf(superClass.getDeclaredMethods()),
METHOD_FILTER)) {
@@ -120,7 +119,7 @@
addTest(warning("No tests found in " + theClass.getName()));
}
- private void addTestMethod(Method m, Vector names, Class theClass) {
+ private void addTestMethod(Method m, Vector<String> names, Class<?> theClass) {
String name = m.getName();
if (names.contains(name))
return;
@@ -133,10 +132,6 @@
addTest(createTest(theClass, name));
}
- private boolean ingoreMethod(Method m) {
- return HAS_FAILING.apply(m);
- }
-
private boolean isPublicTestMethod(Method m) {
return isTestMethod(m) && Modifier.isPublic(m.getModifiers());
}