I'm checking this in.

This genericizes java.net and its support code.  It also fixes a few
other random warnings along the way.

This change caught a bug in the ftp protocol handler; see
FTPURLConnection.addRequestPropertyValue.

We're down to 6 warnings in java.net.  4 are serialization warnings
(and ignorable), one is due to a field we don't use (another
serialization warning, of a different kind), and one is an unused
variable in URI ... but the code here looks a bit weird and I wasn't
immediately sure whether removing this variable was the correct fix.

Tom

2006-12-18  Tom Tromey  <[EMAIL PROTECTED]>

        * vm/reference/java/net/VMNetworkInterface.java (addresses):
        Genericized.
        (VMNetworkInterface): Updated.
        * java/net/URLClassLoader.java (urls): Genericized.
        (urlinfos): Likewise.
        (addURLImpl): Updated.
        (findClass): Likewise.
        (newInstance): Likewise.
        * java/net/URL.java (ph_cache): Genericized.
        (getURLStreamHandler): Updated.
        * java/net/ResolverCache.java (cache): Genericized.
        (killqueue): Likewise.
        * java/net/NetworkInterface.java (getInetAddresses): Genericized.
        * java/net/MimeTypeMapper.java (mime_types): Genericized.
        (fillFromFile): Likewise.
        (main): Likewise.
        * gnu/java/net/protocol/jar/Handler.java (flat): Genericized.
        * gnu/java/net/protocol/jar/Connection.java (JarFileCache.cache):
        Genericized.
        (JarFileCache.get): Updated.
        * gnu/java/net/protocol/http/SimpleCookieManager.java (cookies):
        Genericized.
        (SimpleCookieManager): Updated.
        (setCookie): Likewise.
        (getCookies): Likewise.
        (addCookies): Likewise.
        * gnu/java/net/protocol/http/Request.java (responseHeaderHandlers):
        Genericized.
        (Request): Updated.
        (createResponseBodyStream): Removed unused variable.
        * gnu/java/net/protocol/http/HTTPURLConnection.java (connect): Remove
        unused variable.
        (getRequestProperties): Genericized.
        * gnu/java/net/protocol/http/HTTPConnection.java
        (handshakeCompletedListeners): Genericized.
        (nonceCounts): Likewise.
        (HTTPConnection): Updated.
        (Pool.connectionPool): Likewise.
        (getNonceCount): Updated.
        (incrementNonce): Likewise.
        * gnu/java/net/protocol/http/Headers.java (headers): Genericized.
        * gnu/java/net/protocol/http/ChunkedInputStream.java (CR, LF): Removed
        unused fields.
        * gnu/java/net/protocol/ftp/FTPURLConnection.java (connect):
        Genericized.
        (getRequestProperties): Likewise.
        (addRequestPropertyValue): Likewise.  Fixed return result.
        * gnu/java/net/protocol/ftp/FTPConnection.java (nameList):
        Genericized.
        * gnu/java/net/local/LocalSocket.java: Fixed imports.
        * gnu/java/net/local/LocalServerSocket.java: Fixed imports.
        * gnu/java/net/loader/URLStreamHandlerCache.java (factoryCache):
        Genericized.
        (add): Updated.
        (get): Likewise.
        * gnu/java/net/loader/URLLoader.java (getClassPath): Genericized.
        * gnu/java/net/loader/JarURLLoader.java (classPath): Genericized.
        (initialize): Updated.
        (getClassPath): Genericized.
        * gnu/java/net/IndexListParser.java (prefixes): Genericized.
        (IndexListParser): Updated.
        (getHeaders): Likewise.
        * gnu/java/net/HeaderFieldHelper.java (headerFieldKeys): Genericized.
        (headerFieldValues): Likewise.
        (HeaderFieldHelper): Updated.
        (getHeaderFieldValueByKey): Likewise.
        (getHeaderFields): Likewise.
        * gnu/java/net/GetLocalHostAction.java: Genericized.
        * gnu/java/net/DefaultContentHandlerFactory.java (imageTypes):
        Genericized.

Index: gnu/java/net/DefaultContentHandlerFactory.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/net/DefaultContentHandlerFactory.java,v
retrieving revision 1.1
diff -u -r1.1 DefaultContentHandlerFactory.java
--- gnu/java/net/DefaultContentHandlerFactory.java      5 Apr 2006 20:16:02 
-0000       1.1
+++ gnu/java/net/DefaultContentHandlerFactory.java      17 Dec 2006 22:30:13 
-0000
@@ -81,8 +81,8 @@
       "image/x-xpixmap"
     };
    
-  private static HashSet imageTypes
-    = new HashSet(Arrays.asList(known_image_types));
+  private static HashSet<String> imageTypes
+    = new HashSet<String>(Arrays.asList(known_image_types));
 
   public ContentHandler createContentHandler(String mimeType)
   {
Index: gnu/java/net/GetLocalHostAction.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/net/GetLocalHostAction.java,v
retrieving revision 1.2
diff -u -r1.2 GetLocalHostAction.java
--- gnu/java/net/GetLocalHostAction.java        2 Jul 2005 20:32:13 -0000       
1.2
+++ gnu/java/net/GetLocalHostAction.java        17 Dec 2006 22:30:13 -0000
@@ -48,9 +48,9 @@
  * @author Chris Burdess ([EMAIL PROTECTED])
  */
 public class GetLocalHostAction
-  implements PrivilegedAction
+  implements PrivilegedAction<InetAddress>
 {
-  public Object run()
+  public InetAddress run()
   {
     try
       {
Index: gnu/java/net/HeaderFieldHelper.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/net/HeaderFieldHelper.java,v
retrieving revision 1.7
diff -u -r1.7 HeaderFieldHelper.java
--- gnu/java/net/HeaderFieldHelper.java 2 Jul 2005 20:32:13 -0000       1.7
+++ gnu/java/net/HeaderFieldHelper.java 17 Dec 2006 22:30:13 -0000
@@ -49,8 +49,8 @@
  */
 public class HeaderFieldHelper
 {
-  private Vector headerFieldKeys;
-  private Vector headerFieldValues;
+  private Vector<String> headerFieldKeys;
+  private Vector<String> headerFieldValues;
 
   public HeaderFieldHelper()
   {
@@ -59,8 +59,8 @@
 
   public HeaderFieldHelper (int size)
   {
-    headerFieldKeys = new Vector (size);
-    headerFieldValues = new Vector (size);
+    headerFieldKeys = new Vector<String> (size);
+    headerFieldValues = new Vector<String> (size);
   }
 
   public void addHeaderField (String key, String value)
@@ -75,7 +75,7 @@
 
     try
       {
-        key = (String) headerFieldKeys.elementAt (index);
+        key = headerFieldKeys.elementAt (index);
       }
     catch (ArrayIndexOutOfBoundsException e)
       {
@@ -90,7 +90,7 @@
 
     try
       {
-        value = (String) headerFieldValues.elementAt (index);
+        value = headerFieldValues.elementAt (index);
       }
     catch (ArrayIndexOutOfBoundsException e)
       {
@@ -105,8 +105,7 @@
 
     try
       {
-       value = (String) headerFieldValues.elementAt
-                          (headerFieldKeys.indexOf(key));
+       value = headerFieldValues.elementAt(headerFieldKeys.indexOf(key));
       }
     catch (ArrayIndexOutOfBoundsException e)
       {
@@ -115,9 +114,9 @@
     return value;
   }
 
-  public Map getHeaderFields()
+  public Map<String, String> getHeaderFields()
   {
-    HashMap headers = new HashMap();
+    HashMap<String, String> headers = new HashMap<String, String>();
     int max = headerFieldKeys.size();
 
     for (int index = 0; index < max; index++)
Index: gnu/java/net/IndexListParser.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/net/IndexListParser.java,v
retrieving revision 1.4
diff -u -r1.4 IndexListParser.java
--- gnu/java/net/IndexListParser.java   14 Jun 2006 14:37:50 -0000      1.4
+++ gnu/java/net/IndexListParser.java   17 Dec 2006 22:30:14 -0000
@@ -43,6 +43,7 @@
 import java.net.URL;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
+import java.util.Set;
 import java.util.jar.JarFile;
 
 /**
@@ -70,7 +71,8 @@
   double versionNumber;
   // Map each jar to the prefixes defined for the jar.
   // This is intentionally kept in insertion order.
-  LinkedHashMap prefixes = new LinkedHashMap();
+  LinkedHashMap<URL, Set<String>> prefixes
+    = new LinkedHashMap<URL, Set<String>>();
   
   /**
    * Parses the given jarfile's INDEX.LIST file if it exists.
@@ -107,7 +109,7 @@
         while ((line = br.readLine()) != null)
           {
             URL jarURL = new URL(baseURL, line);
-            HashSet values = new HashSet();
+            HashSet<String> values = new HashSet<String>();
             
             // Read the names in the section.
             while ((line = br.readLine()) != null)
@@ -174,7 +176,7 @@
    * 
    * @return an map of all the headers, or null if no INDEX.LIST was found
    */
-  public LinkedHashMap getHeaders()
+  public LinkedHashMap<URL, Set<String>> getHeaders()
   {
     return prefixes;
   }
Index: gnu/java/net/loader/JarURLLoader.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/net/loader/JarURLLoader.java,v
retrieving revision 1.5
diff -u -r1.5 JarURLLoader.java
--- gnu/java/net/loader/JarURLLoader.java       14 Jun 2006 14:37:50 -0000      
1.5
+++ gnu/java/net/loader/JarURLLoader.java       17 Dec 2006 22:30:14 -0000
@@ -32,7 +32,7 @@
   // Base jar: url for all resources loaded from jar.
   final URL baseJarURL;
   // The "Class-Path" attribute of this Jar's manifest.
-  ArrayList classPath;
+  ArrayList<URLLoader> classPath;
   // If not null, a mapping from INDEX.LIST for this jar only.
   // This is a set of all prefixes and top-level files that
   // ought to be available in this jar.
@@ -90,20 +90,20 @@
 
         IndexListParser parser = new IndexListParser(jarfile, baseJarURL,
                                                      baseURL);
-        LinkedHashMap indexMap = parser.getHeaders();
+        LinkedHashMap<URL, Set<String>> indexMap = parser.getHeaders();
         if (indexMap != null)
           {
             // Note that the index also computes
             // the resulting Class-Path -- there are jars out there
             // where the index lists some required jars which do
             // not appear in the Class-Path attribute in the manifest.
-            this.classPath = new ArrayList();
-            Iterator it = indexMap.entrySet().iterator();
+            this.classPath = new ArrayList<URLLoader>();
+            Iterator<Map.Entry<URL, Set<String>>> it = 
indexMap.entrySet().iterator();
             while (it.hasNext())
               {
-                Map.Entry entry = (Map.Entry) it.next();
-                URL subURL = (URL) entry.getKey();
-                Set prefixes = (Set) entry.getValue();
+                Map.Entry<URL, Set<String>> entry = it.next();
+                URL subURL = entry.getKey();
+                Set<String> prefixes = entry.getValue();
                 if (subURL.equals(baseURL))
                   this.indexSet = prefixes;
                 else
@@ -127,7 +127,7 @@
                       = attributes.getValue(Attributes.Name.CLASS_PATH)) 
                      != null))
           {
-            this.classPath = new ArrayList();
+            this.classPath = new ArrayList<URLLoader>();
             StringTokenizer st = new StringTokenizer(classPathString, " ");
             while (st.hasMoreElements ()) 
               {
@@ -144,7 +144,7 @@
                                                               cache, factory,
                                                               subURL, subURL);
                     this.classPath.add(subLoader);
-                    ArrayList extra = subLoader.getClassPath();
+                    ArrayList<URLLoader> extra = subLoader.getClassPath();
                     if (extra != null)
                       this.classPath.addAll(extra);
                   }
@@ -208,7 +208,7 @@
       }
   }
 
-  public ArrayList getClassPath()
+  public ArrayList<URLLoader> getClassPath()
   {
     return classPath;
   }
Index: gnu/java/net/loader/URLLoader.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/net/loader/URLLoader.java,v
retrieving revision 1.2
diff -u -r1.2 URLLoader.java
--- gnu/java/net/loader/URLLoader.java  19 May 2006 20:58:59 -0000      1.2
+++ gnu/java/net/loader/URLLoader.java  17 Dec 2006 22:30:14 -0000
@@ -140,7 +140,7 @@
    * Return a list of new URLLoader objects representing any
    * class path entries added by this container.
    */
-  public ArrayList getClassPath()
+  public ArrayList<URLLoader> getClassPath()
   {
     return null;
   }
Index: gnu/java/net/loader/URLStreamHandlerCache.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/net/loader/URLStreamHandlerCache.java,v
retrieving revision 1.1
diff -u -r1.1 URLStreamHandlerCache.java
--- gnu/java/net/loader/URLStreamHandlerCache.java      15 May 2006 23:29:36 
-0000      1.1
+++ gnu/java/net/loader/URLStreamHandlerCache.java      17 Dec 2006 22:30:14 
-0000
@@ -51,7 +51,8 @@
    * private protocol handler cache (also a HashMap), so we can avoid
    * creating handlers each time the same protocol comes.
    */
-  private HashMap factoryCache = new HashMap(5);
+  private HashMap<URLStreamHandlerFactory, HashMap<String, URLStreamHandler>> 
factoryCache
+    = new HashMap<URLStreamHandlerFactory, HashMap<String, 
URLStreamHandler>>(5);
 
   public URLStreamHandlerCache()
   {
@@ -62,7 +63,7 @@
     // Since we only support three protocols so far, 5 is enough
     // for cache initial size.
     if (factory != null && factoryCache.get(factory) == null)
-      factoryCache.put(factory, new HashMap(5));
+      factoryCache.put(factory, new HashMap<String, URLStreamHandler>(5));
   }
 
   public synchronized URLStreamHandler get(URLStreamHandlerFactory factory,
@@ -71,8 +72,8 @@
     if (factory == null)
       return null;
     // Check if there're handler for the same protocol in cache.
-    HashMap cache = (HashMap) factoryCache.get(factory);
-    URLStreamHandler handler = (URLStreamHandler) cache.get(protocol);
+    HashMap<String, URLStreamHandler> cache = factoryCache.get(factory);
+    URLStreamHandler handler = cache.get(protocol);
     if (handler == null)
       {
         // Add it to cache.
Index: gnu/java/net/local/LocalServerSocket.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/net/local/LocalServerSocket.java,v
retrieving revision 1.1
diff -u -r1.1 LocalServerSocket.java
--- gnu/java/net/local/LocalServerSocket.java   16 Apr 2006 21:54:09 -0000      
1.1
+++ gnu/java/net/local/LocalServerSocket.java   17 Dec 2006 22:30:14 -0000
@@ -44,7 +44,6 @@
 import java.net.ServerSocket;
 import java.net.Socket;
 import java.net.SocketAddress;
-import java.net.SocketException;
 
 public final class LocalServerSocket extends ServerSocket
 {
Index: gnu/java/net/local/LocalSocket.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/net/local/LocalSocket.java,v
retrieving revision 1.2
diff -u -r1.2 LocalSocket.java
--- gnu/java/net/local/LocalSocket.java 28 Jun 2006 18:28:33 -0000      1.2
+++ gnu/java/net/local/LocalSocket.java 17 Dec 2006 22:30:14 -0000
@@ -46,7 +46,6 @@
 import java.net.Socket;
 import java.net.SocketAddress;
 import java.net.SocketException;
-import java.net.SocketImpl;
 
 import java.nio.channels.IllegalBlockingModeException;
 import java.nio.channels.SocketChannel;
Index: gnu/java/net/protocol/ftp/FTPConnection.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/net/protocol/ftp/FTPConnection.java,v
retrieving revision 1.4
diff -u -r1.4 FTPConnection.java
--- gnu/java/net/protocol/ftp/FTPConnection.java        21 Apr 2006 21:43:07 
-0000      1.4
+++ gnu/java/net/protocol/ftp/FTPConnection.java        17 Dec 2006 22:30:14 
-0000
@@ -1139,7 +1139,7 @@
    * @param pathname the directory pathname, or null
    * @return a list of filenames(strings)
    */
-  public List nameList(String pathname)
+  public List<String> nameList(String pathname)
     throws IOException
   {
     if (dtp == null || transferMode == MODE_STREAM)
@@ -1164,7 +1164,7 @@
         in = new BufferedInputStream(in);
         in = new CRLFInputStream(in);     // TODO ensure that TYPE is correct
         LineInputStream li = new LineInputStream(in);
-        List ret = new ArrayList();
+        ArrayList<String> ret = new ArrayList<String>();
         for (String line = li.readLine();
              line != null;
              line = li.readLine())
Index: gnu/java/net/protocol/ftp/FTPURLConnection.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/net/protocol/ftp/FTPURLConnection.java,v
retrieving revision 1.6
diff -u -r1.6 FTPURLConnection.java
--- gnu/java/net/protocol/ftp/FTPURLConnection.java     2 Mar 2006 00:26:58 
-0000       1.6
+++ gnu/java/net/protocol/ftp/FTPURLConnection.java     17 Dec 2006 22:30:14 
-0000
@@ -50,7 +50,9 @@
 import java.net.URL;
 import java.net.URLConnection;
 import java.security.AccessController;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -112,7 +114,7 @@
       {
         username = "anonymous";
         GetLocalHostAction a = new GetLocalHostAction();
-        InetAddress localhost =(InetAddress) AccessController.doPrivileged(a);
+        InetAddress localhost = AccessController.doPrivileged(a);
         password = SystemProperties.getProperty("user.name") + "@" +
           ((localhost == null) ? "localhost" : localhost.getHostName());
       }
@@ -232,9 +234,9 @@
     return null;
   }
 
-  public Map getRequestProperties()
+  public Map<String, List<String>> getRequestProperties()
   {
-    Map map = new HashMap();
+    Map<String, List<String>> map = new HashMap<String, List<String>>();
     addRequestPropertyValue(map, "passive");
     addRequestPropertyValue(map, "representationType");
     addRequestPropertyValue(map, "fileStructure");
@@ -242,10 +244,13 @@
     return map;
   }
 
-  private void addRequestPropertyValue(Map map, String key)
+  private void addRequestPropertyValue(Map<String, List<String>> map,
+                                       String key)
   {
     String value = getRequestProperty(key);
-    map.put(key, value);
+    ArrayList<String> l = new ArrayList<String>();
+    l.add(value);
+    map.put(key, l);
   }
   
   public void setRequestProperty(String key, String value)
Index: gnu/java/net/protocol/http/ChunkedInputStream.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/net/protocol/http/ChunkedInputStream.java,v
retrieving revision 1.7
diff -u -r1.7 ChunkedInputStream.java
--- gnu/java/net/protocol/http/ChunkedInputStream.java  27 Feb 2006 22:50:33 
-0000      1.7
+++ gnu/java/net/protocol/http/ChunkedInputStream.java  17 Dec 2006 22:30:14 
-0000
@@ -58,10 +58,6 @@
 public class ChunkedInputStream
   extends InputStream
 {
-
-  private static final byte CR = 0x0d;
-  private static final byte LF = 0x0a;
-
   Headers headers;
 
   /** The underlying stream. */
Index: gnu/java/net/protocol/http/HTTPConnection.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/net/protocol/http/HTTPConnection.java,v
retrieving revision 1.15
diff -u -r1.15 HTTPConnection.java
--- gnu/java/net/protocol/http/HTTPConnection.java      8 Dec 2006 20:45:43 
-0000       1.15
+++ gnu/java/net/protocol/http/HTTPConnection.java      17 Dec 2006 22:30:14 
-0000
@@ -129,7 +129,7 @@
    */
   protected int minorVersion;
 
-  private final List handshakeCompletedListeners;
+  private final List<HandshakeCompletedListener> handshakeCompletedListeners;
 
   /**
    * The socket this connection communicates on.
@@ -154,7 +154,7 @@
   /**
    * Nonce values seen by this connection.
    */
-  private Map nonceCounts;
+  private Map<String, Integer> nonceCounts;
 
   /**
    * The cookie manager for this connection.
@@ -244,7 +244,8 @@
     this.connectionTimeout = connectionTimeout;
     this.timeout = timeout;
     majorVersion = minorVersion = 1;
-    handshakeCompletedListeners = new ArrayList(2);
+    handshakeCompletedListeners
+      = new ArrayList<HandshakeCompletedListener>(2);
   }
 
   /**
@@ -357,7 +358,8 @@
     /**
      * The pool
      */
-    final LinkedList connectionPool = new LinkedList();
+    final LinkedList<HTTPConnection> connectionPool
+      = new LinkedList<HTTPConnection>();
 
     /**
      * Maximum size of the pool.
@@ -857,7 +859,7 @@
       {
         return 0;
       }
-    return((Integer) nonceCounts.get(nonce)).intValue();
+    return nonceCounts.get(nonce).intValue();
   }
 
   /**
@@ -868,7 +870,7 @@
     int current = getNonceCount(nonce);
     if (nonceCounts == null)
       {
-        nonceCounts = new HashMap();
+        nonceCounts = new HashMap<String, Integer>();
       }
     nonceCounts.put(nonce, new Integer(current + 1));
   }
Index: gnu/java/net/protocol/http/HTTPURLConnection.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java,v
retrieving revision 1.29
diff -u -r1.29 HTTPURLConnection.java
--- gnu/java/net/protocol/http/HTTPURLConnection.java   15 Dec 2006 07:30:23 
-0000      1.29
+++ gnu/java/net/protocol/http/HTTPURLConnection.java   17 Dec 2006 22:30:15 
-0000
@@ -55,7 +55,6 @@
 
 import javax.net.ssl.HandshakeCompletedEvent;
 import javax.net.ssl.HandshakeCompletedListener;
-import javax.net.ssl.HostnameVerifier;
 import javax.net.ssl.HttpsURLConnection;
 import javax.net.ssl.SSLPeerUnverifiedException;
 import javax.net.ssl.SSLSocketFactory;
@@ -171,7 +170,8 @@
             if (secure)
               {
                 SSLSocketFactory factory = getSSLSocketFactory();
-                HostnameVerifier verifier = getHostnameVerifier();
+                // FIXME: use the verifier
+                // HostnameVerifier verifier = getHostnameVerifier();
                 if (factory != null)
                   {
                     connection.setSSLSocketFactory(factory);
@@ -429,12 +429,12 @@
     return requestHeaders.getValue(key);
   }
 
-  public Map getRequestProperties()
+  public Map<String, List<String>> getRequestProperties()
   {
     if (connected)
       throw new IllegalStateException("Already connected");
     
-    Map m = requestHeaders.getAsMap();
+    Map<String, List<String>> m = requestHeaders.getAsMap();
     return Collections.unmodifiableMap(m);
   }
 
Index: gnu/java/net/protocol/http/Headers.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/http/Headers.java,v
retrieving revision 1.9
diff -u -r1.9 Headers.java
--- gnu/java/net/protocol/http/Headers.java     15 Dec 2006 07:30:23 -0000      
1.9
+++ gnu/java/net/protocol/http/Headers.java     17 Dec 2006 22:30:15 -0000
@@ -66,7 +66,8 @@
   /**
    * A list of HeaderElements
    */
-  private final ArrayList<HeaderElement> headers = new ArrayList();
+  private final ArrayList<HeaderElement> headers
+    = new ArrayList<HeaderElement>();
   
   /**
    * The HTTP dateformat used to parse date header fields.
Index: gnu/java/net/protocol/http/Request.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/http/Request.java,v
retrieving revision 1.10
diff -u -r1.10 Request.java
--- gnu/java/net/protocol/http/Request.java     11 Aug 2006 20:51:20 -0000      
1.10
+++ gnu/java/net/protocol/http/Request.java     17 Dec 2006 22:30:15 -0000
@@ -96,7 +96,7 @@
   /**
    * Map of response header handlers.
    */
-  protected Map responseHeaderHandlers;
+  protected Map<String, ResponseHeaderHandler> responseHeaderHandlers;
 
   /**
    * The authenticator.
@@ -121,7 +121,7 @@
     this.method = method;
     this.path = path;
     requestHeaders = new Headers();
-    responseHeaderHandlers = new HashMap();
+    responseHeaderHandlers = new HashMap<String, ResponseHeaderHandler>();
   }
 
   /**
@@ -461,7 +461,6 @@
     throws IOException
   {
     long contentLength = -1;
-    Headers trailer = null;
     
     // Persistent connections are the default in HTTP/1.1
     boolean doClose = "close".equalsIgnoreCase(getHeader("Connection")) ||
Index: gnu/java/net/protocol/http/SimpleCookieManager.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/net/protocol/http/SimpleCookieManager.java,v
retrieving revision 1.2
diff -u -r1.2 SimpleCookieManager.java
--- gnu/java/net/protocol/http/SimpleCookieManager.java 2 Jul 2005 20:32:13 
-0000       1.2
+++ gnu/java/net/protocol/http/SimpleCookieManager.java 17 Dec 2006 22:30:15 
-0000
@@ -42,7 +42,6 @@
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -59,23 +58,23 @@
    * The cookie cache.
    * This is a dictionary mapping domains to maps of cookies by name.
    */
-  protected Map cookies;
+  protected Map<String, Map<String, Cookie>> cookies;
 
   /**
    * Constructor.
    */
   public SimpleCookieManager()
   {
-    cookies = new HashMap();
+    cookies = new HashMap<String, Map<String, Cookie>>();
   }
 
   public void setCookie(Cookie cookie)
   {
     String domain = cookie.getDomain();
-    Map map =(Map) cookies.get(domain);
+    Map<String, Cookie> map = cookies.get(domain);
     if (map == null)
       {
-        map = new HashMap();
+        map = new HashMap<String, Cookie>();
         cookies.put(domain, map);
       }
     String name = cookie.getName();
@@ -84,7 +83,7 @@
 
   public Cookie[] getCookies(String host, boolean secure, String path)
   {
-    List matches = new ArrayList();
+    ArrayList<Cookie> matches = new ArrayList<Cookie>();
     Date now = new Date();
     if (Character.isLetter(host.charAt(0)))
       {
@@ -102,16 +101,15 @@
     return ret;
   }
 
-  private void addCookies(List matches, String domain, boolean secure,
-                          String path, Date now)
+  private void addCookies(ArrayList<Cookie> matches, String domain,
+                          boolean secure, String path, Date now)
   {
-    Map map = (Map) cookies.get(domain);
+    Map<String, Cookie> map = cookies.get(domain);
     if (map != null)
       {
-        List expired = new ArrayList();
-        for (Iterator i = map.entrySet().iterator(); i.hasNext(); )
+        ArrayList<String> expired = new ArrayList<String>();
+        for (Map.Entry<String, Cookie> entry : map.entrySet())
           {
-            Map.Entry entry = (Map.Entry) i.next();
             Cookie cookie = (Cookie) entry.getValue();
             Date expires = cookie.getExpiryDate();
             if (expires != null && expires.before(now))
@@ -129,7 +127,7 @@
               }
           }
         // Good housekeeping
-        for (Iterator i = expired.iterator(); i.hasNext(); )
+        for (Iterator<String> i = expired.iterator(); i.hasNext(); )
           {
             map.remove(i.next());
           }
Index: gnu/java/net/protocol/jar/Connection.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/net/protocol/jar/Connection.java,v
retrieving revision 1.14
diff -u -r1.14 Connection.java
--- gnu/java/net/protocol/jar/Connection.java   12 May 2006 23:56:26 -0000      
1.14
+++ gnu/java/net/protocol/jar/Connection.java   17 Dec 2006 22:30:15 -0000
@@ -76,7 +76,8 @@
   
   public static class JarFileCache
   {
-    private static Hashtable cache = new Hashtable();
+    private static Hashtable<URL, JarFile> cache
+      = new Hashtable<URL, JarFile>();
     private static final int READBUFSIZE = 4*1024;
     
     public static synchronized JarFile get (URL url, boolean useCaches)
@@ -85,7 +86,7 @@
       JarFile jf;
       if (useCaches)
         {
-          jf = (JarFile) cache.get (url);
+          jf = cache.get (url);
           if (jf != null)
             return jf;
         }
Index: gnu/java/net/protocol/jar/Handler.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/jar/Handler.java,v
retrieving revision 1.13
diff -u -r1.13 Handler.java
--- gnu/java/net/protocol/jar/Handler.java      7 Nov 2006 23:06:37 -0000       
1.13
+++ gnu/java/net/protocol/jar/Handler.java      17 Dec 2006 22:30:15 -0000
@@ -164,7 +164,7 @@
     if (jar_path.indexOf("/.") < 0)
       return url_string;
 
-    ArrayList tokens = new ArrayList();
+    ArrayList<String> tokens = new ArrayList<String>();
     StringTokenizer st = new StringTokenizer(jar_path, "/");
     while (st.hasMoreTokens())
       {
@@ -183,7 +183,7 @@
     StringBuffer path = new StringBuffer(url_string.length());
     path.append(url_string.substring(0, jar_stop + 1));
 
-    Iterator it = tokens.iterator();
+    Iterator<String> it = tokens.iterator();
     while (it.hasNext())
       path.append('/').append(it.next());
 
Index: java/net/MimeTypeMapper.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/MimeTypeMapper.java,v
retrieving revision 1.10
diff -u -r1.10 MimeTypeMapper.java
--- java/net/MimeTypeMapper.java        5 Apr 2006 20:16:03 -0000       1.10
+++ java/net/MimeTypeMapper.java        17 Dec 2006 22:30:35 -0000
@@ -232,7 +232,8 @@
   /**
    * The MIME types above are put into this Hashtable for faster lookup.
    */
-  private Hashtable mime_types = new Hashtable(150);
+  private Hashtable<String, String> mime_types
+    = new Hashtable<String, String>(150);
 
   /**
    * Create a new <code>MimeTypeMapper</code> object.
@@ -257,7 +258,7 @@
       }
   }
 
-  public static void fillFromFile (Map table, String fname) 
+  public static void fillFromFile (Map<String, String> table, String fname) 
     throws IOException
   {
     LineNumberReader reader = 
@@ -325,7 +326,7 @@
    */
   public static void main(String[] args) throws IOException
   {
-    TreeMap map = new TreeMap();
+    TreeMap<String, String> map = new TreeMap<String, String>();
     // It is fine to hard-code the name here.  This is only ever
     // used by maintainers, who can hack it if they need to re-run
     // it.
Index: java/net/NetworkInterface.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/NetworkInterface.java,v
retrieving revision 1.22
diff -u -r1.22 NetworkInterface.java
--- java/net/NetworkInterface.java      10 Dec 2006 20:25:45 -0000      1.22
+++ java/net/NetworkInterface.java      17 Dec 2006 22:30:35 -0000
@@ -40,12 +40,8 @@
 
 import gnu.classpath.SystemProperties;
 
-import java.util.Collection;
-import java.util.Collections;
 import java.util.Enumeration;
-import java.util.HashMap;
 import java.util.Iterator;
-import java.util.Map;
 import java.util.Vector;
 
 /**
@@ -100,7 +96,8 @@
   public Enumeration<InetAddress> getInetAddresses()
   {
     SecurityManager s = System.getSecurityManager();
-    Vector inetAddresses = new Vector(netif.addresses);
+    Vector<InetAddress> inetAddresses
+      = new Vector<InetAddress>(netif.addresses);
 
     if (s == null)
       return inetAddresses.elements();
Index: java/net/ResolverCache.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/ResolverCache.java,v
retrieving revision 1.1
diff -u -r1.1 ResolverCache.java
--- java/net/ResolverCache.java 19 Sep 2006 08:55:29 -0000      1.1
+++ java/net/ResolverCache.java 17 Dec 2006 22:30:36 -0000
@@ -97,12 +97,12 @@
   /**
    * The cache itself.
    */
-  private static HashMap cache = new HashMap();
+  private static HashMap<Object, Entry> cache = new HashMap<Object, Entry>();
 
   /**
    * List of entries which may expire.
    */
-  private static LinkedList killqueue = new LinkedList();
+  private static LinkedList<Entry> killqueue = new LinkedList<Entry>();
 
   /**
    * Return the hostname for the specified IP address.
Index: java/net/URL.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/URL.java,v
retrieving revision 1.56
diff -u -r1.56 URL.java
--- java/net/URL.java   7 Dec 2006 21:58:41 -0000       1.56
+++ java/net/URL.java   17 Dec 2006 22:30:36 -0000
@@ -190,7 +190,8 @@
    * This a table where we cache protocol handlers to avoid the overhead
    * of looking them up each time.
    */
-  private static HashMap ph_cache = new HashMap();
+  private static HashMap<String, URLStreamHandler> ph_cache
+    = new HashMap<String, URLStreamHandler>();
 
   /**
    * Whether or not to cache protocol handlers.
@@ -901,7 +902,7 @@
     // First, see if a protocol handler is in our cache.
     if (cache_handlers)
       {
-       if ((ph = (URLStreamHandler) ph_cache.get(protocol)) != null)
+       if ((ph = ph_cache.get(protocol)) != null)
          return ph;
       }
 
@@ -934,9 +935,9 @@
        // Cache the systemClassLoader
        if (systemClassLoader == null)
          {
-           systemClassLoader = (ClassLoader) AccessController.doPrivileged
-             (new PrivilegedAction() {
-                 public Object run()
+           systemClassLoader = AccessController.doPrivileged
+             (new PrivilegedAction<ClassLoader>() {
+                 public ClassLoader run()
                  {
                    return ClassLoader.getSystemClassLoader();
                  }
Index: java/net/URLClassLoader.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/URLClassLoader.java,v
retrieving revision 1.52
diff -u -r1.52 URLClassLoader.java
--- java/net/URLClassLoader.java        10 Dec 2006 20:25:45 -0000      1.52
+++ java/net/URLClassLoader.java        17 Dec 2006 22:30:37 -0000
@@ -145,7 +145,7 @@
   // Instance variables
 
   /** Locations to load classes from */
-  private final Vector urls = new Vector();
+  private final Vector<URL> urls = new Vector<URL>();
 
   /**
    * Store pre-parsed information for each url into this vector: each
@@ -153,7 +153,7 @@
    * attribute which adds to the URLs that will be searched, but this
    * does not add to the list of urls.
    */
-  private final Vector urlinfos = new Vector();
+  private final Vector<URLLoader> urlinfos = new Vector<URLLoader>();
 
   /** Factory used to get the protocol handlers of the URLs */
   private final URLStreamHandlerFactory factory;
@@ -301,7 +301,6 @@
         if ("file".equals (protocol))
           {
             File dir = new File(file);
-            URL absUrl;
             try
               {
                 absoluteURL = dir.getCanonicalFile().toURL();
@@ -329,12 +328,12 @@
         // First see if we can find a handler with the correct name.
         try
           {
-            Class handler = Class.forName(URL_LOADER_PREFIX + protocol);
-            Class[] argTypes = new Class[] { URLClassLoader.class,
-                                             URLStreamHandlerCache.class,
-                                             URLStreamHandlerFactory.class,
-                                             URL.class,
-                                             URL.class };
+            Class<?> handler = Class.forName(URL_LOADER_PREFIX + protocol);
+            Class<?>[] argTypes = new Class<?>[] { URLClassLoader.class,
+                                                   URLStreamHandlerCache.class,
+                                                   
URLStreamHandlerFactory.class,
+                                                   URL.class,
+                                                   URL.class };
             Constructor k = handler.getDeclaredConstructor(argTypes);
             loader
               = (URLLoader) k.newInstance(new Object[] { this,
@@ -395,7 +394,7 @@
           }
 
        urlinfos.add(loader);
-       ArrayList extra = loader.getClassPath();
+       ArrayList<URLLoader> extra = loader.getClassPath();
         if (extra != null)
           urlinfos.addAll(extra);
       }
@@ -602,10 +601,10 @@
         Class result = null;
         if (sm != null && securityContext != null)
           {
-            result = (Class)AccessController.doPrivileged
-              (new PrivilegedAction()
+            result = AccessController.doPrivileged
+              (new PrivilegedAction<Class>()
                 {
-                  public Object run()
+                  public Class run()
                   {
                     return defineClass(className, classData,
                                        0, classData.length,
@@ -848,9 +847,9 @@
                                       + securityContext);
 
         URLClassLoader loader =
-          (URLClassLoader) AccessController.doPrivileged(new PrivilegedAction()
+          AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>()
               {
-                public Object run()
+                public URLClassLoader run()
                 {
                   return new URLClassLoader(parent,
                                             (AccessControlContext) 
securityContext);
Index: vm/reference/java/net/VMNetworkInterface.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/vm/reference/java/net/VMNetworkInterface.java,v
retrieving revision 1.6
diff -u -r1.6 VMNetworkInterface.java
--- vm/reference/java/net/VMNetworkInterface.java       24 Oct 2006 23:19:47 
-0000      1.6
+++ vm/reference/java/net/VMNetworkInterface.java       17 Dec 2006 22:31:07 
-0000
@@ -58,12 +58,12 @@
 final class VMNetworkInterface
 {
   String name;
-  Set addresses;
+  Set<InetAddress> addresses;
 
   VMNetworkInterface(String name)
   {
     this.name = name;
-    addresses = new HashSet();
+    addresses = new HashSet<InetAddress>();
   }
   
   /**
@@ -72,7 +72,7 @@
    */
   public VMNetworkInterface()
   {
-    addresses = new HashSet();
+    addresses = new HashSet<InetAddress>();
     try
       {
         addresses.add(InetAddress.getByName("0.0.0.0"));

Reply via email to