harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r414469 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io: BufferedWriter.java EmulatedFields.java EmulatedFieldsForDumping.java File.java InputStreamReader.java ObjectInputStream.java ObjectOutputStream.java
Date Thu, 15 Jun 2006 05:24:52 GMT
Author: ndbeyer
Date: Wed Jun 14 22:24:51 2006
New Revision: 414469

URL: http://svn.apache.org/viewvc?rev=414469&view=rev
Log:
Cleanup various compiler warnings.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedWriter.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/EmulatedFields.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/EmulatedFieldsForDumping.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InputStreamReader.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectOutputStream.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedWriter.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedWriter.java?rev=414469&r1=414468&r2=414469&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedWriter.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedWriter.java
Wed Jun 14 22:24:51 2006
@@ -22,7 +22,7 @@
 
 /**
  * BufferedWriter is for writing buffered character output. Characters written
- * to this Writer are buffered internally before being commited to the target
+ * to this Writer are buffered internally before being committed to the target
  * Writer.
  * 
  * @see BufferedReader
@@ -34,8 +34,8 @@
 
 	private int pos;
 
-	private final String lineSeparator = (String) AccessController
-			.doPrivileged(new PriviAction("line.separator")); //$NON-NLS-1$
+	private final String lineSeparator = AccessController
+			.doPrivileged(new PriviAction<String>("line.separator")); //$NON-NLS-1$
 
 	/**
 	 * Constructs a new BufferedReader with <code>out</code> as the Writer on

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/EmulatedFields.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/EmulatedFields.java?rev=414469&r1=414468&r2=414469&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/EmulatedFields.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/EmulatedFields.java
Wed Jun 14 22:24:51 2006
@@ -99,7 +99,7 @@
 
 	/**
 	 * Return a boolean indicating if the field named <code>name</code> has
-	 * been assigned a value explicitely (false) or if it still holds a default
+	 * been assigned a value explicitly (false) or if it still holds a default
 	 * value for the type (true) because it hasn't been assigned to yet.
 	 * 
 	 * @param name
@@ -125,18 +125,18 @@
 	 * field type <code>fieldType</code> corresponds to an object type, the
 	 * field type has to be compatible in terms of assignment, or null is
 	 * returned. If <code>fieldType</code> is <code>null</code>, no
such
-	 * compatibility checking is performed and teh slot is returned.
+	 * compatibility checking is performed and the slot is returned.
 	 * 
 	 * @param fieldName
 	 *            A String, the name of the field to find
 	 * @param fieldType
-	 *            A Class, the type of teh field. This will be used to test
+	 *            A Class, the type of the field. This will be used to test
 	 *            compatibility. If null, no testing is done, the corresponding
 	 *            slot is returned.
 	 * @return If there is no field with that name, or no compatible field
 	 *         (relative to <code>fieldType</code>)
 	 */
-	private ObjectSlot findSlot(String fieldName, Class fieldType) {
+	private ObjectSlot findSlot(String fieldName, Class<?> fieldType) {
 		boolean isPrimitive = fieldType != null && fieldType.isPrimitive();
 
 		for (int i = 0; i < slotsToSerialize.length; i++) {
@@ -536,7 +536,7 @@
 	 *             If the corresponding field can not be found.
 	 */
 	public void put(String name, Object value) throws IllegalArgumentException {
-		Class valueClass = null;
+		Class<?> valueClass = null;
 		if (value != null)
 			valueClass = value.getClass();
 		ObjectSlot slot = findSlot(name, valueClass);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/EmulatedFieldsForDumping.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/EmulatedFieldsForDumping.java?rev=414469&r1=414468&r2=414469&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/EmulatedFieldsForDumping.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/EmulatedFieldsForDumping.java
Wed Jun 14 22:24:51 2006
@@ -194,7 +194,7 @@
 		for (int i = 0; i < slots.length; i++) {
 			EmulatedFields.ObjectSlot slot = slots[i];
 			Object fieldValue = slot.getFieldValue();
-			Class type = slot.getField().getType();
+			Class<?> type = slot.getField().getType();
 			// WARNING - default values exist for each primitive type
 			if (type == Integer.TYPE) {
 				output.writeInt(fieldValue != null ? ((Integer) fieldValue)

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java?rev=414469&r1=414468&r2=414469&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java
Wed Jun 14 22:24:51 2006
@@ -46,23 +46,23 @@
 	byte[] properPath;
 
 	/**
-	 * System dependant file separator character.
+	 * System dependent file separator character.
 	 */
 	public static final char separatorChar;
 
 	/**
-	 * System dependant file separator String. The initial value of this field
+	 * System dependent file separator String. The initial value of this field
 	 * is the System property "file.separator".
 	 */
 	public static final String separator;
 
 	/**
-	 * System dependant path separator character.
+	 * System dependent path separator character.
 	 */
 	public static final char pathSeparatorChar;
 
 	/**
-	 * System dependant path separator String. The initial value of this field
+	 * System dependent path separator String. The initial value of this field
 	 * is the System property "path.separator".
 	 */
 	public static final String pathSeparator;
@@ -284,7 +284,7 @@
 	}
 
 	/**
-	 * Answers a boolean indicating whether or not the current context i allowed
+	 * Answers a boolean indicating whether or not the current context is allowed
 	 * to read this File.
 	 * 
 	 * @return <code>true</code> if this File can be read, <code>false</code>
@@ -327,7 +327,7 @@
      * 
      * @param another
      *            a File to compare the receiver to
-     * @return an int determined by comparing the two paths. The meanning is
+     * @return an int determined by comparing the two paths. The meaning is
      *         described in the Comparable interface.
      * @see Comparable
      */
@@ -570,7 +570,7 @@
 	}
 
 	/**
-	 * Answers the pathname of the parent of this File. This is the path upto
+	 * Answers the pathname of the parent of this File. This is the path up to
 	 * but not including the last name. <code>null</code> is returned when
 	 * there is no parent.
 	 * 
@@ -593,7 +593,7 @@
 
 	/**
 	 * Answers a new File made from the pathname of the parent of this File.
-	 * This is the path upto but not including the last name. <code>null</code>
+	 * This is the path up to but not including the last name. <code>null</code>
 	 * is returned when there is no parent.
 	 * 
 	 * @return a new File representing parent or <code>null</code>
@@ -690,7 +690,7 @@
 	private native boolean isFileImpl(byte[] filePath);
 
 	/**
-	 * Returns wheter or not this file is a hidden file as defined by the
+	 * Returns whether or not this file is a hidden file as defined by the
 	 * operating system.
 	 * 
 	 * @return <code>true</code> if the file is hidden, <code>false</code>
@@ -896,7 +896,7 @@
 		byte[][] implList = listImpl(properPath(true));
 		if (implList == null)
 			return new File[0];
-		java.util.Vector tempResult = new java.util.Vector();
+		java.util.Vector<File> tempResult = new java.util.Vector<File>();
 		for (int index = 0; index < implList.length; index++) {
 			String aName = org.apache.harmony.luni.util.Util.toString(implList[index]);
 			File aFile = new File(this, aName);
@@ -934,7 +934,7 @@
 		byte[][] implList = listImpl(properPath(true));
 		if (implList == null)
 			return new String[0];
-		java.util.Vector tempResult = new java.util.Vector();
+		java.util.Vector<String> tempResult = new java.util.Vector<String>();
 		for (int index = 0; index < implList.length; index++) {
 			String aName = org.apache.harmony.luni.util.Util.toString(implList[index]);
 			if (filter == null || filter.accept(this, aName))
@@ -1065,8 +1065,7 @@
 			if (prefix.length() >= 3) {
 				String newSuffix = suffix == null ? ".tmp" : suffix; //$NON-NLS-1$
 				String tmpDir = "."; //$NON-NLS-1$
-				tmpDir = (String) AccessController
-						.doPrivileged(new PriviAction("java.io.tmpdir", "."));   //$NON-NLS-1$//$NON-NLS-2$
+				tmpDir = AccessController.doPrivileged(new PriviAction<String>("java.io.tmpdir",
"."));   //$NON-NLS-1$//$NON-NLS-2$
 				File result, tmpDirFile = directory == null ? new File(tmpDir)
 						: directory;
 				do {
@@ -1109,8 +1108,7 @@
 		// Check security by getting user.dir when the path is not absolute
 		String userdir;
 		if (internal) {
-			userdir = (String) AccessController.doPrivileged(new PriviAction(
-					"user.dir")); //$NON-NLS-1$
+			userdir = AccessController.doPrivileged(new PriviAction<String>("user.dir")); //$NON-NLS-1$
 		} else
 			userdir = System.getProperty("user.dir"); //$NON-NLS-1$
 		if ((properPath = properPathImpl(pathBytes)) != null)
@@ -1175,7 +1173,7 @@
 
 	/**
 	 * Answers a <code>file</code> URI for this File. The URI is System
-	 * dependant and may not be transferrable between different operating/file
+	 * dependent and may not be transferable between different operating/file
 	 * systems.
 	 * 
 	 * @return a <code>file</code> URI for this File.
@@ -1199,7 +1197,7 @@
 
 	/**
 	 * Answers a <code>file</code> URL for this File. The URL is System
-	 * dependant and may not be transferrable between different operating/file
+	 * dependent and may not be transferable between different operating/file
 	 * systems.
 	 * 
 	 * @return a <code>file</code> URL for this File.
@@ -1219,19 +1217,17 @@
 	}
 
 	private String getAbsoluteName() {
-		String name = getAbsolutePath();
-		if (isDirectory() && name.charAt(name.length() - 1) != separatorChar) // Directories
-																				// must
-																				// end
-																				// with
-																				// a
-																				// slash
-			name = new StringBuilder(name.length() + 1).append(name).append('/')
-					.toString();
-		if (separatorChar != '/') // Must convert slashes.
-			name = name.replace(separatorChar, '/');
-		return name;
-	}
+        String name = getAbsolutePath();
+        if (isDirectory() && name.charAt(name.length() - 1) != separatorChar) {
+            // Directories must end with a slash
+            name = new StringBuilder(name.length() + 1).append(name)
+                    .append('/').toString();
+        }
+        if (separatorChar != '/') { // Must convert slashes.
+            name = name.replace(separatorChar, '/');
+        }
+        return name;
+    }
 
 	private void writeObject(ObjectOutputStream stream) throws IOException {
 		stream.defaultWriteObject();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InputStreamReader.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InputStreamReader.java?rev=414469&r1=414468&r2=414469&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InputStreamReader.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InputStreamReader.java
Wed Jun 14 22:24:51 2006
@@ -20,7 +20,6 @@
 import java.nio.CharBuffer;
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CoderResult;
 import java.nio.charset.CodingErrorAction;
 import java.security.AccessController;
 import java.util.HashMap;
@@ -61,8 +60,8 @@
 	public InputStreamReader(InputStream in) {
 		super(in);
 		this.in = in;
-		String encoding = (String) AccessController
-				.doPrivileged(new PriviAction("file.encoding", "ISO8859_1")); //$NON-NLS-1$//$NON-NLS-2$
+		String encoding = AccessController
+				.doPrivileged(new PriviAction<String>("file.encoding", "ISO8859_1")); //$NON-NLS-1$//$NON-NLS-2$
 		decoder = Charset.forName(encoding).newDecoder();
 		chars.limit(0);
 	}
@@ -105,7 +104,7 @@
 	 * @param in
 	 *            the InputStream to convert to characters
 	 * @param dec
-	 *            a CharsetDecoder used by the character convertion
+	 *            a CharsetDecoder used by the character conversion
 	 */
 	public InputStreamReader(InputStream in, CharsetDecoder dec) {
 		super(in);
@@ -170,7 +169,7 @@
 	 * helper for getEncoding()
 	 */
 	static class HistoricalNamesUtil {
-		private static HashMap historicalNames = new HashMap();
+		private static HashMap<String, String> historicalNames = new HashMap<String, String>();
 		static {
 			historicalNames.put("Big5-HKSCS", "Big5_HKSCS");
 			historicalNames.put("EUC-JP", "EUC_JP");

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java?rev=414469&r1=414468&r2=414469&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java
Wed Jun 14 22:24:51 2006
@@ -52,7 +52,7 @@
     // If the receiver has already read & not consumed a TC code
     private boolean hasPushbackTC;
 
-    // Pushback TC code if teh variable above is true
+    // Push back TC code if the variable above is true
     private byte pushbackTC;
 
     // How many nested levels to readObject. When we reach 0 we have to validate
@@ -100,7 +100,7 @@
     private Integer descriptorHandle;
 
     // cache for readResolve methods
-    private IdentityHashMap readResolveCache;
+    private IdentityHashMap<Class<?>, Object> readResolveCache;
 
     // Internal type used to keep track of validators & corresponding priority
     class InputValidationDesc {
@@ -265,8 +265,8 @@
      */
     public ObjectInputStream(InputStream input)
             throws StreamCorruptedException, IOException {
-        final Class implementationClass = getClass();
-        final Class thisClass = ObjectInputStream.class;
+        final Class<?> implementationClass = getClass();
+        final Class<?> thisClass = ObjectInputStream.class;
         SecurityManager sm = System.getSecurityManager();
         if (sm != null && implementationClass != thisClass) {
             boolean mustCheck = (AccessController
@@ -304,7 +304,7 @@
         primitiveTypes = new DataInputStream(this);
         enableResolve = false;
         this.subclassOverridingImplementation = false;
-        this.readResolveCache = new IdentityHashMap();
+        this.readResolveCache = new IdentityHashMap<Class<?>, Object>();
         resetState();
         nestedLevels = 0;
         // So read...() methods can be used by
@@ -388,7 +388,7 @@
 
     /**
      * Default method to read objects from the receiver. Fields defined in the
-     * object's class and superclasses (which are Serializable) will be read.
+     * object's class and super classes (which are Serializable) will be read.
      * 
      * @throws IOException
      *             If an IO error occurs attempting to read the object data
@@ -448,7 +448,7 @@
      * @return <code>true</code> if the two classes belong to the same
      *         package, <code>false</code> otherwise
      */
-    private boolean inSamePackage(Class c1, Class c2) {
+    private boolean inSamePackage(Class<?> c1, Class<?> c2) {
         String nameC1 = c1.getName();
         String nameC2 = c2.getName();
         int indexDotC1 = nameC1.lastIndexOf('.');
@@ -478,8 +478,8 @@
      *            The empty constructor to run will be in this class
      * @return the object created from <code>instantiationClass</code>
      */
-    private static native Object newInstance(Class instantiationClass,
-            Class constructorClass);
+    private static native Object newInstance(Class<?> instantiationClass,
+            Class<?> constructorClass);
 
     /**
      * Return the next <code>int</code> handle to be used to indicate cyclic
@@ -681,7 +681,7 @@
         case TC_CLASSDESC:
             return readNewClassDesc(false);
         case TC_PROXYCLASSDESC:
-            Class proxyClass = readNewProxyClassDesc();
+            Class<?> proxyClass = readNewProxyClassDesc();
             ObjectStreamClass streamClass = ObjectStreamClass
                     .lookup(proxyClass);
             streamClass.setLoadFields(new ObjectStreamField[0]);
@@ -983,7 +983,7 @@
                 .slots();
         for (int i = 0; i < slots.length; i++) {
             slots[i].defaulted = false;
-            Class type = slots[i].field.getType();
+            Class<?> type = slots[i].field.getType();
             if (type == Integer.TYPE) {
                 slots[i].fieldValue = new Integer(input.readInt());
             } else if (type == Byte.TYPE) {
@@ -1045,7 +1045,7 @@
             throws OptionalDataException, ClassNotFoundException, IOException {
         // Now we must read all fields and assign them to the receiver
         ObjectStreamField[] fields = classDesc.getLoadFields();
-        Class declaringClass = classDesc.forClass();
+        Class<?> declaringClass = classDesc.forClass();
         if (declaringClass == null && mustResolve)
             throw new ClassNotFoundException(classDesc.getName());
 
@@ -1114,8 +1114,8 @@
                     mustResolve = true;
                 if (field != null) {
                     if (toSet != null) {
-                        Class fieldType = field.getType();
-                        Class valueType = toSet.getClass();
+                        Class<?> fieldType = field.getType();
+                        Class<?> valueType = toSet.getClass();
                         if (!fieldType.isAssignableFrom(valueType))
                             throw new ClassCastException(Msg.getString(
                                     "K00d4", new String[] { //$NON-NLS-1$
@@ -1222,17 +1222,16 @@
             nextStreamClass = nextStreamClass.getSuperclass();
         }
         if (object == null) {
-            Iterator streamIt = streamClassList.iterator();
+            Iterator<ObjectStreamClass> streamIt = streamClassList.iterator();
             while (streamIt.hasNext()) {
-                ObjectStreamClass streamClass = (ObjectStreamClass) streamIt
-                        .next();
+                ObjectStreamClass streamClass = streamIt.next();
                 readObjectForClass(object, streamClass);
             }
         } else {
-            ArrayList<Class> classList = new ArrayList<Class>(32);
-            Class nextClass = object.getClass();
+            ArrayList<Class<?>> classList = new ArrayList<Class<?>>(32);
+            Class<?> nextClass = object.getClass();
             while (nextClass != null) {
-                Class testClass = nextClass.getSuperclass();
+                Class<?> testClass = nextClass.getSuperclass();
                 if (testClass != null) {
                     classList.add(0, nextClass);
                 }
@@ -1240,7 +1239,7 @@
             }
             int lastIndex = 0;
             for (int i = 0; i < classList.size(); i++) {
-                Class superclass = (Class) classList.get(i);
+                Class<?> superclass = (Class) classList.get(i);
                 int index = findStreamSuperclass(superclass, streamClassList,
                         lastIndex);
                 if (index == -1) {
@@ -1256,18 +1255,17 @@
         }
     }
 
-    private int findStreamSuperclass(Class cl, ArrayList classList,
+    private int findStreamSuperclass(Class<?> cl, ArrayList<ObjectStreamClass>
classList,
             int lastIndex) {
         for (int i = lastIndex; i < classList.size(); i++) {
-            if (cl.getName().equals(
-                    ((ObjectStreamClass) classList.get(i)).getName())) {
+            if (cl.getName().equals(classList.get(i).getName())) {
                 return i;
             }
         }
         return -1;
     }
 
-    private void readObjectNoData(Object object, Class cl)
+    private void readObjectNoData(Object object, Class<?> cl)
             throws ObjectStreamException {
         if (!ObjectStreamClass.isSerializable(cl)) {
             return;
@@ -1276,7 +1274,7 @@
         final Method readMethod = ObjectStreamClass
                 .getPrivateReadObjectNoDataMethod(cl);
         if (readMethod != null) {
-            AccessController.doPrivileged(new PriviAction(readMethod));
+            AccessController.doPrivileged(new PriviAction<Object>(readMethod));
             try {
                 readMethod.invoke(object, new Object[0]);
             } catch (InvocationTargetException e) {
@@ -1300,7 +1298,7 @@
         currentClass = classDesc;
 
         boolean hadWriteMethod = (classDesc.getFlags() & SC_WRITE_METHOD) > 0;
-        Class targetClass = classDesc.forClass();
+        Class<?> targetClass = classDesc.forClass();
         final Method readMethod;
         if (targetClass == null || !mustResolve)
             readMethod = null;
@@ -1310,7 +1308,7 @@
         try {
             if (readMethod != null) {
                 // We have to be able to fetch its value, even if it is private
-                AccessController.doPrivileged(new PriviAction(readMethod));
+                AccessController.doPrivileged(new PriviAction<Object>(readMethod));
                 try {
                     readMethod.invoke(object, new Object[] { this });
                 } catch (InvocationTargetException e) {
@@ -1408,8 +1406,8 @@
 
         // Array size
         int size = input.readInt();
-        Class arrayClass = classDesc.forClass();
-        Class componentType = arrayClass.getComponentType();
+        Class<?> arrayClass = classDesc.forClass();
+        Class<?> componentType = arrayClass.getComponentType();
         Object result = Array.newInstance(componentType, size);
         if (!unshared) {
             registerObjectRead(result, newHandle);
@@ -1480,13 +1478,13 @@
      * @throws ClassNotFoundException
      *             If a class for one of the objects could not be found
      */
-    private Class readNewClass(boolean unshared) throws ClassNotFoundException,
+    private Class<?> readNewClass(boolean unshared) throws ClassNotFoundException,
             IOException {
         ObjectStreamClass classDesc = readClassDesc();
 
         if (classDesc != null) {
             Integer newHandle = new Integer(nextHandle());
-            Class localClass = classDesc.forClass();
+            Class<?> localClass = classDesc.forClass();
             if (localClass != null && !unshared)
                 registerObjectRead(localClass, newHandle);
             return localClass;
@@ -1562,13 +1560,13 @@
      * @throws ClassNotFoundException
      *             If a class for one of the objects could not be found
      */
-    private Class readNewProxyClassDesc() throws ClassNotFoundException,
+    private Class<?> readNewProxyClassDesc() throws ClassNotFoundException,
             IOException {
         int count = input.readInt();
         String[] interfaceNames = new String[count];
         for (int i = 0; i < count; i++)
             interfaceNames[i] = input.readUTF();
-        Class proxy = resolveProxyClass(interfaceNames);
+        Class<?> proxy = resolveProxyClass(interfaceNames);
         // Consume unread class annotation data and TC_ENDBLOCKDATA
         discardData();
         return proxy;
@@ -1645,12 +1643,12 @@
 
     /**
      * Read a new object from the stream. It is assumed the object has not been
-     * loade yet (not a cyclic reference). Return the object read.
+     * loaded yet (not a cyclic reference). Return the object read.
      * 
      * If the object implements <code>Externalizable</code> its
      * <code>readExternal</code> is called. Otherwise, all fields described by
      * the class hierarchy are loaded. Each class can define how its declared
-     * instance fields are laoded by defining a private method
+     * instance fields are loaded by defining a private method
      * <code>readObject</code>
      * 
      * @param unshared
@@ -1683,14 +1681,14 @@
         // Maybe we should cache the values above in classDesc ? It may be the
         // case that when reading classDesc we may need to read more stuff
         // depending on the values above
-        Class objectClass = classDesc.forClass();
+        Class<?> objectClass = classDesc.forClass();
 
         Object result, registeredResult = null;
         if (objectClass != null) {
             // The class of the instance may not be the same as the class of the
             // constructor to run
             // This is the constructor to run if Externalizable
-            Class constructorClass = objectClass;
+            Class<?> constructorClass = objectClass;
 
             // WARNING - What if the object is serializable and externalizable ?
             // Is that possible ?
@@ -1705,7 +1703,7 @@
             }
 
             // Fetch the empty constructor
-            Constructor constructor;
+            Constructor<?> constructor;
             try {
                 constructor = constructorClass
                         .getDeclaredConstructor(ObjectStreamClass.EMPTY_CONSTRUCTOR_PARAM_TYPES);
@@ -1799,7 +1797,7 @@
                         readResolveMethod = null;
                     } else {
                         // Has replacement method
-                        AccessController.doPrivileged(new PriviAction(
+                        AccessController.doPrivileged(new PriviAction<Object>(
                                 readResolve));
                         readResolveCache.put(objectClass, readResolve);
                         readResolveMethod = readResolve;
@@ -2239,7 +2237,7 @@
      * @throws NoSuchFieldError
      *             If the field does not exist.
      */
-    private static native void setField(Object instance, Class declaringClass,
+    private static native void setField(Object instance, Class<?> declaringClass,
             String fieldName, byte value) throws NoSuchFieldError;
 
     /**
@@ -2265,7 +2263,7 @@
      * @throws NoSuchFieldError
      *             If the field does not exist.
      */
-    private static native void setField(Object instance, Class declaringClass,
+    private static native void setField(Object instance, Class<?> declaringClass,
             String fieldName, char value) throws NoSuchFieldError;
 
     /**
@@ -2291,7 +2289,7 @@
      * @throws NoSuchFieldError
      *             If the field does not exist.
      */
-    private static native void setField(Object instance, Class declaringClass,
+    private static native void setField(Object instance, Class<?> declaringClass,
             String fieldName, double value) throws NoSuchFieldError;
 
     /**
@@ -2317,7 +2315,7 @@
      * @throws NoSuchFieldError
      *             If the field does not exist.
      */
-    private static native void setField(Object instance, Class declaringClass,
+    private static native void setField(Object instance, Class<?> declaringClass,
             String fieldName, float value) throws NoSuchFieldError;
 
     /**
@@ -2343,7 +2341,7 @@
      * @throws NoSuchFieldError
      *             If the field does not exist.
      */
-    private static native void setField(Object instance, Class declaringClass,
+    private static native void setField(Object instance, Class<?> declaringClass,
             String fieldName, int value) throws NoSuchFieldError;
 
     /**
@@ -2369,7 +2367,7 @@
      * @throws NoSuchFieldError
      *             If the field does not exist.
      */
-    private static native void setField(Object instance, Class declaringClass,
+    private static native void setField(Object instance, Class<?> declaringClass,
             String fieldName, long value) throws NoSuchFieldError;
 
     /**
@@ -2397,7 +2395,7 @@
      *             If the field does not exist.
      */
     private static native void objSetField(Object instance,
-            Class declaringClass, String fieldName, String fieldTypeName,
+            Class<?> declaringClass, String fieldName, String fieldTypeName,
             Object value) throws NoSuchFieldError;
 
     /**
@@ -2423,7 +2421,7 @@
      * @throws NoSuchFieldError
      *             If the field does not exist.
      */
-    private static native void setField(Object instance, Class declaringClass,
+    private static native void setField(Object instance, Class<?> declaringClass,
             String fieldName, short value) throws NoSuchFieldError;
 
     /**
@@ -2449,7 +2447,7 @@
      * @throws NoSuchFieldError
      *             If the field does not exist.
      */
-    private static native void setField(Object instance, Class declaringClass,
+    private static native void setField(Object instance, Class<?> declaringClass,
             String fieldName, boolean value) throws NoSuchFieldError;
 
     /**
@@ -2490,7 +2488,7 @@
      */
     private void verifySUID(ObjectStreamClass loadedStreamClass)
             throws InvalidClassException {
-        Class localClass = loadedStreamClass.forClass();
+        Class<?> localClass = loadedStreamClass.forClass();
         // Instances of java.lang.Class are always Serializable, even if their
         // instances aren't (e.g. java.lang.Object.class). We cannot call lookup
         // because it returns null if the parameter represents instances that

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectOutputStream.java?rev=414469&r1=414468&r2=414469&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectOutputStream.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectOutputStream.java
Wed Jun 14 22:24:51 2006
@@ -54,7 +54,7 @@
 	// primitive types are
 	// actually written to
 
-	private IdentityHashMap objectsWritten; // Table mapping Object -> Integer
+	private IdentityHashMap<Object, Integer> objectsWritten; // Table mapping Object ->
Integer
 
 	// (handle)
 
@@ -90,7 +90,7 @@
 	// to call
 	// writeObjectOverride
 
-	private IdentityHashMap writeReplaceCache; // cache for writeReplace
+	private IdentityHashMap<Class<?>, Object> writeReplaceCache; // cache for writeReplace
 
 	// methods
 
@@ -195,8 +195,8 @@
 	 *             header
 	 */
 	public ObjectOutputStream(OutputStream output) throws IOException {
-		Class implementationClass = getClass();
-		Class thisClass = ObjectInputStream.class;
+		Class<?> implementationClass = getClass();
+		Class<?> thisClass = ObjectInputStream.class;
 		if (implementationClass != thisClass) {
 			boolean mustCheck = false;
 			try {
@@ -227,7 +227,7 @@
 		this.enableReplace = false;
 		this.protocolVersion = PROTOCOL_VERSION_2;
 		this.subclassOverridingImplementation = false;
-		this.writeReplaceCache = new IdentityHashMap();
+		this.writeReplaceCache = new IdentityHashMap<Class<?>, Object>();
 
 		resetState();
 		this.nestedException = new StreamCorruptedException();
@@ -452,7 +452,7 @@
 	 * @throws		NoSuchFieldError If the field does not exist.
 	 */
 	private static native boolean getFieldBool(Object instance,
-			Class declaringClass, String fieldName);
+			Class<?> declaringClass, String fieldName);
 
 	/**
 	 * Get the value of field named
@@ -473,7 +473,7 @@
 	 * @throws		NoSuchFieldError If the field does not exist.
 	 */
 	private static native byte getFieldByte(Object instance,
-			Class declaringClass, String fieldName);
+            Class<?> declaringClass, String fieldName);
 
 	/**
 	 * Get the value of field named
@@ -494,7 +494,7 @@
 	 * @throws		NoSuchFieldError If the field does not exist.
 	 */
 	private static native char getFieldChar(Object instance,
-			Class declaringClass, String fieldName);
+            Class<?> declaringClass, String fieldName);
 
 	/**
 	 * Get the value of field named
@@ -515,7 +515,7 @@
 	 * @throws		NoSuchFieldError If the field does not exist.
 	 */
 	private static native double getFieldDouble(Object instance,
-			Class declaringClass, String fieldName);
+            Class<?> declaringClass, String fieldName);
 
 	/**
 	 * Get the value of field named
@@ -536,7 +536,7 @@
 	 * @throws		NoSuchFieldError If the field does not exist.
 	 */
 	private static native float getFieldFloat(Object instance,
-			Class declaringClass, String fieldName);
+            Class<?> declaringClass, String fieldName);
 
 	/**
 	 * Get the value of field named
@@ -557,7 +557,7 @@
 	 * @throws		NoSuchFieldError If the field does not exist.
 	 */
 	private static native int getFieldInt(Object instance,
-			Class declaringClass, String fieldName);
+            Class<?> declaringClass, String fieldName);
 
 	/**
 	 * Get the value of field named
@@ -578,7 +578,7 @@
 	 * @throws		NoSuchFieldError If the field does not exist.
 	 */
 	private static native long getFieldLong(Object instance,
-			Class declaringClass, String fieldName);
+            Class<?> declaringClass, String fieldName);
 
 	/**
 	 * Get the value of field named
@@ -600,7 +600,7 @@
 	 * @throws		NoSuchFieldError If the field does not exist.
 	 */
 	private static native Object getFieldObj(Object instance,
-			Class declaringClass, String fieldName, String fieldTypeName);
+            Class<?> declaringClass, String fieldName, String fieldTypeName);
 
 	/**
 	 * Get the value of field named
@@ -621,7 +621,7 @@
 	 * @throws		NoSuchFieldError If the field does not exist.
 	 */
 	private static native short getFieldShort(Object instance,
-			Class declaringClass, String fieldName);
+            Class<?> declaringClass, String fieldName);
 
 	/**
 	 * Return the next <code>int</code> handle to be used to indicate cyclic
@@ -769,7 +769,7 @@
 	 * 
 	 */
 	private void resetSeenObjects() {
-		objectsWritten = new IdentityHashMap();
+		objectsWritten = new IdentityHashMap<Object, Integer>();
 		currentHandle = baseWireHandle;
 	}
 
@@ -955,7 +955,7 @@
 			handle = dumpCycle(classDesc);
 		}
 		if (handle == null) {
-			Class classToWrite = classDesc.forClass();
+            Class<?> classToWrite = classDesc.forClass();
 			Integer previousHandle = (Integer) objectsWritten.get(classDesc);
 			// If we got here, it is a new (non-null) classDesc that will have
 			// to be registered as well
@@ -1014,7 +1014,7 @@
 	 *             descriptor.
 	 * 
 	 */
-	private Integer writeClassDescForClass(Class objClass) throws IOException {
+	private Integer writeClassDescForClass(Class<?> objClass) throws IOException {
 		return writeClassDesc(ObjectStreamClass.lookup(objClass), false);
 	}
 
@@ -1068,7 +1068,7 @@
 	 */
 	private void writeFieldDescriptors(ObjectStreamClass classDesc,
 			boolean externalizable) throws IOException {
-		Class loadedClass = classDesc.forClass();
+        Class<?> loadedClass = classDesc.forClass();
 		ObjectStreamField[] fields = null;
 		int fieldCount = 0;
 
@@ -1134,7 +1134,7 @@
 		for (int i = 0; i < slots.length; i++) {
 			EmulatedFields.ObjectSlot slot = slots[i];
 			Object fieldValue = slot.getFieldValue();
-			Class type = slot.getField().getType();
+            Class<?> type = slot.getField().getType();
 			// WARNING - default values exist for each primitive type
 			if (type == Integer.TYPE) {
 				output.writeInt(fieldValue != null ? ((Integer) fieldValue)
@@ -1188,7 +1188,7 @@
 	private void writeFieldValues(Object obj, ObjectStreamClass classDesc)
 			throws IOException {
 		ObjectStreamField[] fields = classDesc.fields();
-		Class declaringClass = classDesc.forClass();
+        Class<?> declaringClass = classDesc.forClass();
 		for (int i = 0; i < fields.length; i++) {
 			try {
 				// Code duplication starts, just because Java is typed
@@ -1306,14 +1306,14 @@
 
 			// See if the object has a writeObject method. If so, run it
 			boolean executed = false;
-			Class targetClass = classDesc.forClass();
+            Class<?> targetClass = classDesc.forClass();
 			try {
 				final Method method = ObjectStreamClass
 						.getPrivateWriteObjectMethod(targetClass);
 				if (method != null) {
 					// We have to be able to fetch its value, even if it is
 					// private
-					AccessController.doPrivileged(new PriviAction(method));
+					AccessController.doPrivileged(new PriviAction<Object>(method));
 					try {
 						method.invoke(object, new Object[] { this });
 						executed = true;
@@ -1397,8 +1397,8 @@
 	 * @throws IOException
 	 *             If an IO exception happened when writing the array.
 	 */
-	private Integer writeNewArray(Object array, Class arrayClass,
-			Class componentType, boolean unshared) throws IOException {
+	private Integer writeNewArray(Object array, Class<?> arrayClass,
+            Class<?> componentType, boolean unshared) throws IOException {
 		output.writeByte(TC_ARRAY);
 		writeClassDescForClass(arrayClass);
 
@@ -1483,7 +1483,7 @@
 	 * @throws IOException
 	 *             If an IO exception happened when writing the class.
 	 */
-	private Integer writeNewClass(Class object, boolean unshared) throws IOException {
+	private Integer writeNewClass(Class<?> object, boolean unshared) throws IOException
{
 		output.writeByte(TC_CLASS);
 
 		// Instances of java.lang.Class
@@ -1609,7 +1609,7 @@
 	 * @throws IOException
 	 *             If an IO exception happened when writing the object.
 	 */
-	private Integer writeNewObject(Object object, Class theClass,
+	private Integer writeNewObject(Object object, Class<?> theClass,
 			boolean unshared) throws IOException {
 		// Not String, not null, not array, not cyclic reference
 
@@ -1820,7 +1820,7 @@
 		}
 
 		// Non-null object, first time seen...
-		Class objClass = object.getClass();
+        Class<?> objClass = object.getClass();
 		nestedLevels++;
 		try {
 
@@ -1845,7 +1845,7 @@
 							writeReplaceMethod = null;
 						} else {
 							// Has replacement method
-							AccessController.doPrivileged(new PriviAction(
+							AccessController.doPrivileged(new PriviAction<Object>(
 									writeReplace));
 							writeReplaceCache.put(objClass, writeReplace);
 							writeReplaceMethod = writeReplace;



Mime
View raw message