harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r553238 - /harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/
Date Wed, 04 Jul 2007 15:21:09 GMT
Author: tonywu
Date: Wed Jul  4 08:21:07 2007
New Revision: 553238

URL: http://svn.apache.org/viewvc?view=rev&rev=553238
Log:
clean up compiler warnings in io module, no functional change.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest1.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest2.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest3.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest4.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest5.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/StreamTokenizerTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/StringBufferInputStreamTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest.java?view=diff&rev=553238&r1=553237&r2=553238
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest.java
Wed Jul  4 08:21:07 2007
@@ -62,6 +62,7 @@
  * Automated Test Suite for class java.io.ObjectOutputStream
  * 
  */
+@SuppressWarnings("serial")
 public class SerializationStressTest extends junit.framework.TestCase implements
 		Serializable {
 
@@ -92,14 +93,14 @@
 	// -----------------------------------------------------------------------------------
 
 	private static class ObjectInputStreamSubclass extends ObjectInputStream {
-		private Vector resolvedClasses = new Vector();
+		private Vector<Class> resolvedClasses = new Vector<Class>();
 
 		public ObjectInputStreamSubclass(InputStream in) throws IOException,
 				StreamCorruptedException {
 			super(in);
 		}
 
-		public Class resolveClass(ObjectStreamClass osClass)
+		public Class<?> resolveClass(ObjectStreamClass osClass)
 				throws IOException, ClassNotFoundException {
 			Class result = super.resolveClass(osClass);
 			resolvedClasses.addElement(result);
@@ -111,25 +112,24 @@
 					.size()]);
 		}
 	}
+	static final Map<String , String> TABLE = new Hashtable<String , String>();
 
-	static final Map TABLE = new Hashtable();
+	static final Map<String , String> MAP = new HashMap<String , String>();
 
-	static final Map MAP = new HashMap();
+	static final SortedMap<String , String> TREE = new TreeMap<String , String>();
 
-	static final SortedMap TREE = new TreeMap();
+	static final LinkedHashMap<String , String> LINKEDMAP = new LinkedHashMap<String
, String>();
 
-	static final LinkedHashMap LINKEDMAP = new LinkedHashMap();
+	static final LinkedHashSet<String> LINKEDSET = new LinkedHashSet<String>();
 
-	static final LinkedHashSet LINKEDSET = new LinkedHashSet();
+	static final IdentityHashMap<String , String> IDENTITYMAP = new IdentityHashMap<String
, String>();
 
-	static final IdentityHashMap IDENTITYMAP = new IdentityHashMap();
-
-	static final List ALIST = Arrays.asList(new String[] { "a", "list", "of",
+	static final List<String> ALIST = Arrays.asList(new String[] { "a", "list", "of",
 			"strings" });
 
-	static final List LIST = new ArrayList(ALIST);
+	static final List<String> LIST = new ArrayList<String>(ALIST);
 
-	static final Set SET = new HashSet(Arrays.asList(new String[] { "one",
+	static final Set<String> SET = new HashSet<String>(Arrays.asList(new String[]
{ "one",
 			"two", "three" }));
 
 	static final Permission PERM = new PropertyPermission("file.encoding",
@@ -137,7 +137,7 @@
 
 	static final PermissionCollection PERMCOL = PERM.newPermissionCollection();
 
-	static final SortedSet SORTSET = new TreeSet(Arrays.asList(new String[] {
+	static final SortedSet<String> SORTSET = new TreeSet<String>(Arrays.asList(new
String[] {
 			"one", "two", "three" }));
 
 	static final java.text.DateFormat DATEFORM = java.text.DateFormat
@@ -152,7 +152,7 @@
 	static final java.text.MessageFormat MESSAGE = new java.text.MessageFormat(
 			"the time: {0,time} and date {0,date}");
 
-	static final LinkedList LINKEDLIST = new LinkedList(Arrays
+	static final LinkedList<String> LINKEDLIST = new LinkedList<String>(Arrays
 			.asList(new String[] { "a", "linked", "list", "of", "strings" }));
 
 	static final SimpleTimeZone TIME_ZONE = new SimpleTimeZone(3600000,
@@ -396,7 +396,6 @@
 	public void test_7_write() {
 		// Test for method void java.io.ObjectOutputStream.write(int)
 		try {
-			byte[] buf = new byte[10];
 			oos.write('T');
 			oos.close();
 			ois = new ObjectInputStream(loadStream());
@@ -945,7 +944,7 @@
 
 	public void test_1_writeReplace() {
 		try {
-			Vector v = new Vector();
+			Vector<Object> v = new Vector<Object>();
 			v.addElement(new WriteReplaceTestA());
 			v.addElement(new WriteReplaceTestB());
 			v.addElement(new WriteReplaceTestB());

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest1.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest1.java?view=diff&rev=553238&r1=553237&r2=553238
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest1.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest1.java
Wed Jul  4 08:21:07 2007
@@ -20,7 +20,10 @@
 import java.io.NotSerializableException;
 import java.io.Serializable;
 import java.util.Arrays;
+import java.util.Hashtable;
+import java.util.Vector;
 
+@SuppressWarnings( { "serial", "unused" })
 public class SerializationStressTest1 extends SerializationStressTest {
 
 	// The purpose of these two classes is to test if serialization, when
@@ -110,7 +113,7 @@
 		private void readObject(java.io.ObjectInputStream in)
 				throws java.io.IOException, ClassNotFoundException {
 			calledReadObject = true;
-			String s = ((String) in.readObject());
+			in.readObject();
 		}
 
 		private void writeObject(java.io.ObjectOutputStream out)
@@ -135,7 +138,7 @@
 		public void readObject(java.io.ObjectInputStream in)
 				throws java.io.IOException, ClassNotFoundException {
 			calledReadObject = true;
-			String s = ((String) in.readObject());
+			in.readObject();
 		}
 
 		public void writeObject(java.io.ObjectOutputStream out)
@@ -638,7 +641,7 @@
 		// java.io.ObjectOutputStream.writeObject(java.lang.Object)
 
 		Object objToSave = null;
-		Object objLoaded;
+        Object objLoaded;
 
 		try {
 
@@ -1089,7 +1092,7 @@
 		Object objLoaded;
 
 		try {
-			java.util.Vector vector = new java.util.Vector(1);
+			Vector<String> vector = new Vector<String>(1);
 			vector.add(FOO);
 			objToSave = vector;
 			if (DEBUG)
@@ -1119,10 +1122,11 @@
 		Object objLoaded;
 
 		try {
-			java.util.Hashtable hashTable = new java.util.Hashtable(5);
-			hashTable.put(FOO, FOO);
-			objToSave = hashTable;
-			if (DEBUG)
+			Hashtable<String, String> hashTable = new Hashtable<String, String>(
+                    5);
+            hashTable.put(FOO, FOO);
+            objToSave = hashTable;
+            if (DEBUG)
 				System.out.println("Obj = " + objToSave);
 			objLoaded = dumpAndReload(objToSave);
 			java.util.Hashtable loadedHashTable = (java.util.Hashtable) objLoaded;

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest2.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest2.java?view=diff&rev=553238&r1=553237&r2=553238
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest2.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest2.java
Wed Jul  4 08:21:07 2007
@@ -35,6 +35,7 @@
 import java.util.Date;
 import java.util.Locale;
 
+@SuppressWarnings( { "serial", "unused" })
 public class SerializationStressTest2 extends SerializationStressTest {
 
 	private static class ReadWriteObjectAndPrimitiveData implements
@@ -402,7 +403,7 @@
 
 			InitializerFieldsTest inst = (InitializerFieldsTest) obj;
 			return inst.toBeSerialized.equals(this.toBeSerialized)
-					&& inst.toBeNotSerialized.equals(this.toBeNotSerialized2);
+					&& InitializerFieldsTest.toBeNotSerialized.equals(toBeNotSerialized2);
 		}
 	}
 
@@ -444,7 +445,7 @@
 					&& inst.toBeSerialized3.equals(this.toBeSerialized3)
 					&& inst.toBeSerialized4.equals(this.toBeSerialized4)
 					&& inst.toBeSerialized5.equals(this.toBeSerialized5)
-					&& inst.toBeNotSerialized.equals(this.toBeNotSerialized2);
+					&& InitializerFieldsTest2.toBeNotSerialized.equals(toBeNotSerialized2);
 		}
 	}
 
@@ -490,8 +491,8 @@
 							.equals(this.sub_toBeSerialized4)
 					&& inst.sub_toBeSerialized5
 							.equals(this.sub_toBeSerialized5)
-					&& inst.sub_toBeNotSerialized
-							.equals(this.sub_toBeNotSerialized2);
+					&& InitializerFieldsTest3.sub_toBeNotSerialized
+							.equals(sub_toBeNotSerialized2);
 		}
 	}
 
@@ -1156,7 +1157,7 @@
 
 		try {
 
-			ArrayList list = new ArrayList(Arrays.asList(new String[] { "a",
+			ArrayList list = new ArrayList<String>(Arrays.asList(new String[] { "a",
 					"list", "of", "strings" }));
 			objToSave = list;
 			if (DEBUG)

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest3.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest3.java?view=diff&rev=553238&r1=553237&r2=553238
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest3.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest3.java
Wed Jul  4 08:21:07 2007
@@ -36,6 +36,7 @@
 import java.util.TimeZone;
 import java.util.Vector;
 
+@SuppressWarnings( { "serial", "unused" })
 public class SerializationStressTest3 extends SerializationStressTest {
 
 	// -----------------------------------------------------------------------------------
@@ -322,7 +323,7 @@
 				new ObjectStreamField("object1", Vector.class),
 				new ObjectStreamField("int1", Integer.TYPE) };
 
-		private static Vector v1 = new Vector(Arrays.asList(new String[] {
+		private static Vector v1 = new Vector<String>(Arrays.asList(new String[] {
 				"1st", "2nd" }));
 
 		private boolean passed = false;
@@ -342,7 +343,8 @@
 			passed = int1 == 0xA9 && object1.equals(v1);
 		}
 
-		private void writeObject(java.io.ObjectOutputStream out)
+		@SuppressWarnings("deprecation")
+        private void writeObject(java.io.ObjectOutputStream out)
 				throws java.io.IOException, ClassNotFoundException {
 			ObjectOutputStream.PutField fields = out.putFields();
 			fields.put("object1", v1);

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest4.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest4.java?view=diff&rev=553238&r1=553237&r2=553238
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest4.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest4.java
Wed Jul  4 08:21:07 2007
@@ -32,22 +32,13 @@
 import java.text.DateFormat;
 import java.text.MessageFormat;
 import java.text.NumberFormat;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.IdentityHashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.TimeZone;
+import java.util.*;
+
 
 import tests.support.Support_Configuration;
 import tests.support.Support_Proxy_I1;
 
+@SuppressWarnings( { "serial", "unused" })
 public class SerializationStressTest4 extends SerializationStressTest {
 	// -----------------------------------------------------------------------------------
 	private static class GuardImplementation implements java.security.Guard,
@@ -104,15 +95,15 @@
 
 		try {
 			objToSave = null;
-			objToSave = new java.security.PermissionCollection() {
+			objToSave = new PermissionCollection() {
 				boolean added = false;
 
 				public void add(java.security.Permission p1) {
 					added = true;
 				}
 
-				public java.util.Enumeration elements() {
-					return (new java.util.Vector()).elements();
+				public Enumeration elements() {
+					return (new Vector()).elements();
 				}
 
 				public boolean implies(java.security.Permission p1) {
@@ -329,7 +320,7 @@
 		Object objLoaded = null;
 
 		try {
-			objToSave = java.util.Collections.unmodifiableCollection(SET);
+			objToSave = Collections.unmodifiableCollection(SET);
 			if (DEBUG)
 				System.out.println("Obj = " + objToSave);
 			objLoaded = dumpAndReload(objToSave);
@@ -587,7 +578,8 @@
 
 	}
 
-	public void test_writeObject_String_CaseInsensitiveComparator() {
+	@SuppressWarnings("unchecked")
+    public void test_writeObject_String_CaseInsensitiveComparator() {
 		// Test for method void
 		// java.io.ObjectOutputStream.writeObject(java.lang.String.CaseInsensitiveComparator)
 
@@ -1731,7 +1723,8 @@
 
 	}
 
-	public void test_writeObject_Permissions() {
+	@SuppressWarnings("unchecked")
+    public void test_writeObject_Permissions() {
 		// Test for method void
 		// java.io.ObjectOutputStream.writeObject(java.security.Permissions)
 
@@ -1776,8 +1769,8 @@
 					}
 				};
 
-				java.util.Arrays.sort(perms1, comparator);
-				java.util.Arrays.sort(perms2, comparator);
+				Arrays.sort(perms1, comparator);
+				Arrays.sort(perms2, comparator);
 
 				for (int i = 0; i < length && equals; ++i)
 					equals = perms1[i].equals(perms2[i]);
@@ -1930,7 +1923,7 @@
 
 	}
 
-	public void test_writeObject_Stack() {
+    public void test_writeObject_Stack() {
 		// Test for method void
 		// java.io.ObjectOutputStream.writeObject(java.util.Stack)
 
@@ -1939,8 +1932,8 @@
 
 		try {
 			objToSave = new java.util.Stack();
-			((java.util.Stack) objToSave).push("String 1");
-			((java.util.Stack) objToSave).push("String 2");
+			((Stack) objToSave).push("String 1");
+			((Stack) objToSave).push("String 2");
 			if (DEBUG)
 				System.out.println("Obj = " + objToSave);
 			objLoaded = dumpAndReload(objToSave);

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest5.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest5.java?view=diff&rev=553238&r1=553237&r2=553238
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest5.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest5.java
Wed Jul  4 08:21:07 2007
@@ -27,13 +27,14 @@
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
+@SuppressWarnings( { "serial", "unused" })
 public class SerializationStressTest5 extends SerializationStressTest {
 
 	transient Throwable current;
 
 	// Use this for retrieving a list of any Throwable Classes that did not get
 	// tested.
-	transient Vector missedV = new Vector();
+	transient Vector<Class> missedV = new Vector<Class>();
 
 	transient Class[][] params = new Class[][] { { String.class },
 			{ Throwable.class }, { Exception.class },
@@ -66,7 +67,7 @@
 
 		File javaDir = findJavaDir();
 
-		Vector classFilesVector = new Vector();
+		Vector<File> classFilesVector = new Vector<File>();
 		if (javaDir != null)
 			findClassFiles(javaDir, classFilesVector);
 		else
@@ -100,7 +101,7 @@
 		int instanceOfSep = -1;
 		int nextInstance = classPath.indexOf(File.pathSeparatorChar,
 				instanceOfSep + 1);
-		Vector elms = new Vector();
+		Vector<File> elms = new Vector<File>();
 		while (nextInstance != -1) {
 			elms.add(new File(classPath.substring(instanceOfSep + 1,
 					nextInstance)));
@@ -138,7 +139,7 @@
 		return null;
 	}
 
-	private void findClassFiles(File dir, Vector v) {
+	private void findClassFiles(File dir, Vector<File> v) {
 		String[] classFileNames = dir.list();
 		for (int i = 0; i < classFileNames.length; i++) {
 			File file = new File(dir, classFileNames[i]);
@@ -150,8 +151,8 @@
 	}
 
 	private Class[] findThrowableClasses(File[] files) {
-		Class thrClass = Throwable.class;
-		Vector resultVector = new Vector();
+		Class<Throwable> thrClass = Throwable.class;
+		Vector<Class> resultVector = new Vector<Class>();
 		String slash = System.getProperty("file.separator");
 		String begTarget = slash + "java" + slash;
 		String endTarget = ".class";
@@ -284,7 +285,7 @@
 		}
 	}
 
-	private void findClassFilesFromZip(Vector v) {
+	private void findClassFilesFromZip(Vector<File> v) {
 		String slash = System.getProperty("file.separator");
 		String javaHome = System.getProperty("java.home");
 		if (!javaHome.endsWith(slash))

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/StreamTokenizerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/StreamTokenizerTest.java?view=diff&rev=553238&r1=553237&r2=553238
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/StreamTokenizerTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/StreamTokenizerTest.java
Wed Jul  4 08:21:07 2007
@@ -26,10 +26,6 @@
 import java.io.StringBufferInputStream;
 
 import tests.support.Support_StringReader;
-// TODO: most of the assertTrue calls in this test case should be
-// replaced with assertEquals (possibly two assertEquals) see
-// test_ConstructorLjava_io_InputStream for example.
-// This gives much more helpful error messages.
 
 public class StreamTokenizerTest extends junit.framework.TestCase {
 	Support_StringReader r;
@@ -41,7 +37,8 @@
 	/**
 	 * @tests java.io.StreamTokenizer#StreamTokenizer(java.io.InputStream)
 	 */
-	public void test_ConstructorLjava_io_InputStream() throws IOException {
+	@SuppressWarnings("deprecation")
+    public void test_ConstructorLjava_io_InputStream() throws IOException {
 		st = new StreamTokenizer(new StringBufferInputStream(
 				"/comments\n d 8 'h'"));
 
@@ -151,7 +148,8 @@
 	/**
 	 * @tests java.io.StreamTokenizer#nextToken()
 	 */
-	public void test_nextToken() throws IOException {
+	@SuppressWarnings("deprecation")
+    public void test_nextToken() throws IOException {
 		// SM.
 		setTest("\r\n/* fje fje 43.4 f \r\n f g */  456.459 \r\n"
 				+ "Hello  / 	\r\n \r\n \n \r \257 Hi \'Hello World\'");

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/StringBufferInputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/StringBufferInputStreamTest.java?view=diff&rev=553238&r1=553237&r2=553238
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/StringBufferInputStreamTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/StringBufferInputStreamTest.java
Wed Jul  4 08:21:07 2007
@@ -19,9 +19,10 @@
 
 import java.io.StringBufferInputStream;
 
+@SuppressWarnings("deprecation")
 public class StringBufferInputStreamTest extends junit.framework.TestCase {
 
-	StringBufferInputStream sbis;
+    StringBufferInputStream sbis;
 
 	/**
 	 * @tests java.io.StringBufferInputStream#StringBufferInputStream(java.lang.String)



Mime
View raw message