I'm checking this in.
This removes warnings from the tools I've worked on: serialver,
native2ascii, and jar. This warning removal includes work
genericizing some of the code.
Tom
2006-12-15 Tom Tromey <[EMAIL PROTECTED]>
* tools/gnu/classpath/tools/serialver/SerialVer.java (addFileURL):
Genericized.
(getClassLoader): Likewise.
(classes): Likewise.
* tools/gnu/classpath/tools/native2ascii/Native2ASCII.java (main):
Removed unused variable.
* tools/gnu/classpath/tools/jar/WorkSet.java (allItems): Genericize.
(initSet): Likewise.
* tools/gnu/classpath/tools/jar/Main.java (entries): Genericize.
* tools/gnu/classpath/tools/jar/Indexer.java (indexJarFile):
Genericized.
* tools/gnu/classpath/tools/jar/Creator.java (writeFile): Close the
input stream.
(writtenItems): Genericize.
(addEntries): Likewise.
(getAllEntries): Likewise.
Index: tools/gnu/classpath/tools/jar/Creator.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/jar/Creator.java,v
retrieving revision 1.6
diff -u -r1.6 Creator.java
--- tools/gnu/classpath/tools/jar/Creator.java 15 Dec 2006 17:43:17 -0000
1.6
+++ tools/gnu/classpath/tools/jar/Creator.java 15 Dec 2006 19:34:25 -0000
@@ -60,7 +60,7 @@
extends Action
{
JarOutputStream outputStream;
- HashSet writtenItems = new HashSet();
+ HashSet<String> writtenItems = new HashSet<String>();
// The manifest to use, or null if we don't want a manifest.
Manifest manifest;
@@ -150,13 +150,13 @@
}
else
{
- InputStream inputStream = new FileInputStream(file);
- writeFile(isDirectory, inputStream, filename, verbose);
- inputStream.close();
+ InputStream inputStream = new FileInputStream(file);
+ writeFile(isDirectory, inputStream, filename, verbose);
+ inputStream.close();
}
}
- private void addEntries(ArrayList result, Entry entry)
+ private void addEntries(ArrayList<Entry> result, Entry entry)
{
if (entry.file.isDirectory())
{
@@ -176,10 +176,10 @@
result.add(entry);
}
- private ArrayList getAllEntries(Main parameters)
+ private ArrayList<Entry> getAllEntries(Main parameters)
{
Iterator it = parameters.entries.iterator();
- ArrayList allEntries = new ArrayList();
+ ArrayList<Entry> allEntries = new ArrayList<Entry>();
while (it.hasNext())
{
Entry entry = (Entry) it.next();
Index: tools/gnu/classpath/tools/jar/Indexer.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/jar/Indexer.java,v
retrieving revision 1.5
diff -u -r1.5 Indexer.java
--- tools/gnu/classpath/tools/jar/Indexer.java 17 May 2006 22:48:02 -0000
1.5
+++ tools/gnu/classpath/tools/jar/Indexer.java 15 Dec 2006 19:34:25 -0000
@@ -72,7 +72,7 @@
// Index the files in this jar.
// The results look a little better if we keep them
// in insertion order.
- LinkedHashSet entries = new LinkedHashSet();
+ LinkedHashSet<String> entries = new LinkedHashSet<String>();
Enumeration e = jf.entries();
while (e.hasMoreElements())
{
Index: tools/gnu/classpath/tools/jar/Main.java
===================================================================
RCS file: /cvsroot/classpath/classpath/tools/gnu/classpath/tools/jar/Main.java,v
retrieving revision 1.7
diff -u -r1.7 Main.java
--- tools/gnu/classpath/tools/jar/Main.java 22 Sep 2006 01:01:26 -0000
1.7
+++ tools/gnu/classpath/tools/jar/Main.java 15 Dec 2006 19:34:25 -0000
@@ -78,7 +78,7 @@
File manifestFile;
/** A list of Entry objects, each describing a file to write. */
- ArrayList entries = new ArrayList();
+ ArrayList<Entry> entries = new ArrayList<Entry>();
/** Used only while parsing, holds the first argument for -C. */
String changedDirectory;
Index: tools/gnu/classpath/tools/jar/WorkSet.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/jar/WorkSet.java,v
retrieving revision 1.1
diff -u -r1.1 WorkSet.java
--- tools/gnu/classpath/tools/jar/WorkSet.java 22 May 2006 01:21:34 -0000
1.1
+++ tools/gnu/classpath/tools/jar/WorkSet.java 15 Dec 2006 19:34:25 -0000
@@ -44,13 +44,13 @@
public class WorkSet
{
- private HashSet allItems;
+ private HashSet<String> allItems;
private void initSet(ArrayList entries)
{
if (entries == null || entries.isEmpty())
return;
- allItems = new HashSet();
+ allItems = new HashSet<String>();
Iterator it = entries.iterator();
while (it.hasNext())
{
Index: tools/gnu/classpath/tools/native2ascii/Native2ASCII.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/native2ascii/Native2ASCII.java,v
retrieving revision 1.3
diff -u -r1.3 Native2ASCII.java
--- tools/gnu/classpath/tools/native2ascii/Native2ASCII.java 22 Sep 2006
01:01:26 -0000 1.3
+++ tools/gnu/classpath/tools/native2ascii/Native2ASCII.java 15 Dec 2006
19:34:25 -0000
@@ -180,6 +180,5 @@
public static void main(String[] args)
{
new Native2ASCII().run(args);
- String encoding = System.getProperty("file.encoding"); //$NON-NLS-1$
}
}
Index: tools/gnu/classpath/tools/serialver/SerialVer.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/serialver/SerialVer.java,v
retrieving revision 1.3
diff -u -r1.3 SerialVer.java
--- tools/gnu/classpath/tools/serialver/SerialVer.java 22 Sep 2006 01:01:26
-0000 1.3
+++ tools/gnu/classpath/tools/serialver/SerialVer.java 15 Dec 2006 19:34:25
-0000
@@ -45,12 +45,12 @@
public class SerialVer
{
// List of classes to load.
- ArrayList classes = new ArrayList();
+ ArrayList<String> classes = new ArrayList<String>();
// The class path to use.
String classpath;
// FIXME: taken from ClassLoader, should share it.
- private static void addFileURL(ArrayList list, String file)
+ private static void addFileURL(ArrayList<URL> list, String file)
{
try
{
@@ -72,7 +72,7 @@
{
StringTokenizer tok = new StringTokenizer(classpath,
File.pathSeparator, true);
- ArrayList list = new ArrayList();
+ ArrayList<URL> list = new ArrayList<URL>();
while (tok.hasMoreTokens())
{
String s = tok.nextToken();