summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2005-10-06 03:03:16 +0000
committerTom Tromey <tromey@redhat.com>2005-10-06 03:03:16 +0000
commit44c3be3f1b3dac7e6884fe03687c1e2721fa4b58 (patch)
treef730a1b559f607020ebdc82dbcc3e997b324aef6
parentbe02def8be1dfac1410bb80969dc39cf1aa0983e (diff)
downloadclasspath-44c3be3f1b3dac7e6884fe03687c1e2721fa4b58.tar.gz
* java/util/jar/Attributes.java: Implements Map<Object,Object>.
(map): Changed type. (entrySet): Changed return type. (keySet): Likewise. (putAll): Changed argument type. (values): Changed return type. * java/util/jar/Manifest.java (getEntries): Genericized. (Manifest): Updated. (entries): Changed type. (read_individual_sections): Updated. (read_section_name): Likewise. (write_main_attributes): Likewise. (write_attribute_entry): Likewise. (write_individual_sections): Likewise. (write_entry_attributes): Likewise. * java/util/jar/JarFile.java (entries): Genericized. (JarEnumeration): Implements Enumeration<JarEntry>. (JarEnumeration.nextElement): Changed return type. (JarEnumeration.entries): Changed type.
-rw-r--r--ChangeLog22
-rw-r--r--java/util/jar/Attributes.java12
-rw-r--r--java/util/jar/JarFile.java10
-rw-r--r--java/util/jar/Manifest.java30
4 files changed, 49 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index d9c4084ee..7cec83954 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
2005-10-05 Tom Tromey <tromey@redhat.com>
+ * java/util/jar/Attributes.java: Implements Map<Object,Object>.
+ (map): Changed type.
+ (entrySet): Changed return type.
+ (keySet): Likewise.
+ (putAll): Changed argument type.
+ (values): Changed return type.
+ * java/util/jar/Manifest.java (getEntries): Genericized.
+ (Manifest): Updated.
+ (entries): Changed type.
+ (read_individual_sections): Updated.
+ (read_section_name): Likewise.
+ (write_main_attributes): Likewise.
+ (write_attribute_entry): Likewise.
+ (write_individual_sections): Likewise.
+ (write_entry_attributes): Likewise.
+ * java/util/jar/JarFile.java (entries): Genericized.
+ (JarEnumeration): Implements Enumeration<JarEntry>.
+ (JarEnumeration.nextElement): Changed return type.
+ (JarEnumeration.entries): Changed type.
+
+2005-10-05 Tom Tromey <tromey@redhat.com>
+
* java/awt/datatransfer/SystemFlavorMap.java (getNativesForFlavors):
Genericized.
(getFlavorsForNatives): Likewise.
diff --git a/java/util/jar/Attributes.java b/java/util/jar/Attributes.java
index 4db2c72e7..9e528553f 100644
--- a/java/util/jar/Attributes.java
+++ b/java/util/jar/Attributes.java
@@ -65,7 +65,7 @@ import java.util.Set;
* @see java.util.jar.Attributes.Name
* @author Mark Wielaard (mark@klomp.org)
*/
-public class Attributes implements Cloneable, Map
+public class Attributes implements Cloneable, Map<Object, Object>
{
// Fields
@@ -75,7 +75,7 @@ public class Attributes implements Cloneable, Map
* implementation it is actually a Hashtable, but that can be different in
* other implementations.
*/
- protected Map map;
+ protected Map<Object, Object> map;
// Inner class
@@ -493,7 +493,7 @@ public class Attributes implements Cloneable, Map
*
* @return a set of attribute name value pairs
*/
- public Set entrySet()
+ public Set<Map.Entry<Object, Object>> entrySet()
{
return map.entrySet();
}
@@ -559,7 +559,7 @@ public class Attributes implements Cloneable, Map
/**
* Gives a Set of all the values of defined attribute names.
*/
- public Set keySet()
+ public Set<Object> keySet()
{
return map.keySet();
}
@@ -588,7 +588,7 @@ public class Attributes implements Cloneable, Map
* @exception ClassCastException if the supplied map is not an instance of
* Attributes
*/
- public void putAll(Map attr)
+ public void putAll(Map<?, ?> attr)
{
if (!(attr instanceof Attributes))
{
@@ -623,7 +623,7 @@ public class Attributes implements Cloneable, Map
* Returns all the values of the defined attribute name/value pairs as a
* Collection.
*/
- public Collection values()
+ public Collection<Object> values()
{
return map.values();
}
diff --git a/java/util/jar/JarFile.java b/java/util/jar/JarFile.java
index 7ccbc60af..97b3711c7 100644
--- a/java/util/jar/JarFile.java
+++ b/java/util/jar/JarFile.java
@@ -304,7 +304,7 @@ public class JarFile extends ZipFile
*
* @exception IllegalStateException when the JarFile is already closed
*/
- public Enumeration entries() throws IllegalStateException
+ public Enumeration<JarEntry> entries() throws IllegalStateException
{
return new JarEnumeration(super.entries(), this);
}
@@ -313,13 +313,13 @@ public class JarFile extends ZipFile
* Wraps a given Zip Entries Enumeration. For every zip entry a
* JarEntry is created and the corresponding Attributes are looked up.
*/
- private static class JarEnumeration implements Enumeration
+ private static class JarEnumeration implements Enumeration<JarEntry>
{
- private final Enumeration entries;
+ private final Enumeration<? extends ZipEntry> entries;
private final JarFile jarfile;
- JarEnumeration(Enumeration e, JarFile f)
+ JarEnumeration(Enumeration<? extends ZipEntry> e, JarFile f)
{
entries = e;
jarfile = f;
@@ -330,7 +330,7 @@ public class JarFile extends ZipFile
return entries.hasMoreElements();
}
- public Object nextElement()
+ public JarEntry nextElement()
{
ZipEntry zip = (ZipEntry) entries.nextElement();
JarEntry jar = new JarEntry(zip);
diff --git a/java/util/jar/Manifest.java b/java/util/jar/Manifest.java
index ff82aa2db..4728acc00 100644
--- a/java/util/jar/Manifest.java
+++ b/java/util/jar/Manifest.java
@@ -64,7 +64,7 @@ public class Manifest implements Cloneable
private final Attributes mainAttr;
/** A map of atrributes for all entries described in this Manifest. */
- private final Map entries;
+ private final Map<String, Attributes> entries;
// Constructors
@@ -74,7 +74,7 @@ public class Manifest implements Cloneable
public Manifest()
{
mainAttr = new Attributes();
- entries = new Hashtable();
+ entries = new Hashtable<String, Attributes>();
}
/**
@@ -108,7 +108,7 @@ public class Manifest implements Cloneable
public Manifest(Manifest man)
{
mainAttr = new Attributes(man.getMainAttributes());
- entries = new Hashtable(man.getEntries());
+ entries = new Hashtable<String, Attributes>(man.getEntries());
}
// Methods
@@ -126,7 +126,7 @@ public class Manifest implements Cloneable
* in this manifest. Adding, changing or removing from this entries map
* changes the entries of this manifest.
*/
- public Map getEntries()
+ public Map<String, Attributes> getEntries()
{
return entries;
}
@@ -279,7 +279,7 @@ public class Manifest implements Cloneable
}
}
- private static void read_individual_sections(Map entries,
+ private static void read_individual_sections(Map<String, Attributes> entries,
BufferedReader br) throws
IOException
{
@@ -293,7 +293,7 @@ public class Manifest implements Cloneable
}
private static Attributes read_section_name(String s, BufferedReader br,
- Map entries) throws JarException
+ Map<String, Attributes> entries) throws JarException
{
try
{
@@ -378,10 +378,10 @@ public class Manifest implements Cloneable
private static void write_main_attributes(Attributes attr, PrintWriter pw)
throws JarException
{
- Iterator it = attr.entrySet().iterator();
+ Iterator<Map.Entry<Object, Object>> it = attr.entrySet().iterator();
while (it.hasNext())
{
- Map.Entry entry = (Map.Entry) it.next();
+ Map.Entry<Object, Object> entry = it.next();
// Don't print the manifest version again
if (!Attributes.Name.MANIFEST_VERSION.equals(entry.getKey()))
{
@@ -390,7 +390,8 @@ public class Manifest implements Cloneable
}
}
- private static void write_attribute_entry(Map.Entry entry, PrintWriter pw)
+ private static void write_attribute_entry(Map.Entry<Object, Object> entry,
+ PrintWriter pw)
throws JarException
{
String name = entry.getKey().toString();
@@ -409,14 +410,15 @@ public class Manifest implements Cloneable
write_header(name, value, pw);
}
- private static void write_individual_sections(Map entries, PrintWriter pw)
+ private static void write_individual_sections(Map<String, Attributes> entries,
+ PrintWriter pw)
throws JarException
{
- Iterator it = entries.entrySet().iterator();
+ Iterator<Map.Entry<String, Attributes>> it = entries.entrySet().iterator();
while (it.hasNext())
{
- Map.Entry entry = (Map.Entry) it.next();
+ Map.Entry<String, Attributes> entry = it.next();
write_header("Name", entry.getKey().toString(), pw);
write_entry_attributes((Attributes) entry.getValue(), pw);
pw.println();
@@ -426,10 +428,10 @@ public class Manifest implements Cloneable
private static void write_entry_attributes(Attributes attr, PrintWriter pw)
throws JarException
{
- Iterator it = attr.entrySet().iterator();
+ Iterator<Map.Entry<Object, Object>> it = attr.entrySet().iterator();
while (it.hasNext())
{
- Map.Entry entry = (Map.Entry) it.next();
+ Map.Entry<Object, Object> entry = it.next();
write_attribute_entry(entry, pw);
}
}