harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r410551 - in /incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar: Attributes.java InitManifest.java JarFile.java Manifest.java Pack200.java
Date Wed, 31 May 2006 14:55:10 GMT
Author: tellison
Date: Wed May 31 07:55:09 2006
New Revision: 410551

URL: http://svn.apache.org/viewvc?rev=410551&view=rev
Log:
Generics uplift in java.util.jar

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Attributes.java
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Manifest.java
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Pack200.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Attributes.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Attributes.java?rev=410551&r1=410550&r2=410551&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Attributes.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Attributes.java
Wed May 31 07:55:09 2006
@@ -26,9 +26,9 @@
  * keys are generally instances of Attributes.Name. Values associated with
  * Attributes keys are of type String.
  */
-public class Attributes implements Cloneable, Map {
+public class Attributes implements Cloneable, Map<Object, Object> {
 
-	protected Map map;
+	protected Map<Object, Object> map;
 
 	public static class Name {
 		private String name;
@@ -121,7 +121,7 @@
 	 * Constructs an Attributes instance
 	 */
 	public Attributes() {
-		map = new HashMap();
+		map = new HashMap<Object, Object>();
 	}
 
 	/**
@@ -132,7 +132,7 @@
 	 *            The Attributes to obtain entries from.
 	 */
 	public Attributes(Attributes attrib) {
-		map = (Map) ((HashMap) attrib.map).clone();
+		map = (Map<Object, Object>)((HashMap) attrib.map).clone();
 	}
 
 	/**
@@ -142,7 +142,7 @@
 	 *            Initial size of this Attributes instance.
 	 */
 	public Attributes(int size) {
-		map = new HashMap(size);
+		map = new HashMap<Object, Object>(size);
 	}
 
 	/**
@@ -182,7 +182,7 @@
 	 * 
 	 * @return a set of MapEntry's
 	 */
-	public Set entrySet() {
+	public Set<Map.Entry<Object, Object>> entrySet() {
 		return map.entrySet();
 	}
 
@@ -211,7 +211,7 @@
 	 * 
 	 * @return a Set of all keys
 	 */
-	public Set keySet() {
+	public Set<Object> keySet() {
 		return map.keySet();
 	}
 
@@ -238,7 +238,7 @@
 	 * @param attrib
 	 *            the associations to store (must be of type Attributes).
 	 */
-	public void putAll(Map attrib) {
+	public void putAll(Map<?, ?> attrib) {
         if( attrib == null ) {
             throw new ClassCastException();
         }
@@ -270,7 +270,7 @@
 	 * 
 	 * @return a Collection of all values present
 	 */
-	public Collection values() {
+	public Collection<Object> values() {
 		return map.values();
 	}
 
@@ -281,7 +281,7 @@
 		} catch (CloneNotSupportedException e) {
 			return null;
 		}
-		clone.map = (Map) ((HashMap) this.map).clone();
+		clone.map = (Map<Object, Object>) ((HashMap) this.map).clone();
 		return clone;
 	}
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java?rev=410551&r1=410550&r2=410551&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java
Wed May 31 07:55:09 2006
@@ -46,7 +46,8 @@
 
 	private boolean usingUTF8 = true;
 
-	private Map attributeNames = new HashMap();
+	private Map<String, Attributes.Name> attributeNames =
+        new HashMap<String, Attributes.Name>();
 
 	private byte[] mainAttributesChunk;
 
@@ -59,7 +60,7 @@
 		}
 
 		Attributes current = main;
-		ArrayList list = new ArrayList();
+		ArrayList<String> list = new ArrayList<String>();
 
 		//Return the chunk of main attributes in the manifest.
 		mainAttributesChunk = nextChunk(is,list);		
@@ -99,7 +100,7 @@
 		return mainAttributesChunk;
 	}
 
-	private void addLine(int length, List lines) throws IOException {
+	private void addLine(int length, List<String> lines) throws IOException {
 		if (encoding != null) {
 			lines.add(new String(buffer, 0, length, encoding));
 		} else {
@@ -128,7 +129,7 @@
 		}
 	}
 
-	private byte[] nextChunk(InputStream in, List lines) throws IOException {
+	private byte[] nextChunk(InputStream in, List<String> lines) throws IOException {
 		if (inbufCount == -1)
 			return null;
 		byte next;
@@ -196,7 +197,7 @@
 		}
 	}
 
-	private boolean readLines(InputStream in, List lines) throws IOException {
+	private boolean readLines(InputStream in, List<String> lines) throws IOException {
 		if (inbufCount == -1)
 			return false;
 		byte next;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java?rev=410551&r1=410550&r2=410551&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java
Wed May 31 07:55:09 2006
@@ -200,8 +200,8 @@
 	 * @exception java.lang.IllegalStateException
 	 *                If this JarFile has been closed.
 	 */
-	public Enumeration entries() {
-		class JarFileEnumerator implements Enumeration {
+	public Enumeration<JarEntry> entries() {
+		class JarFileEnumerator implements Enumeration<JarEntry> {
 			Enumeration ze;
 
 			JarFile jf;
@@ -215,7 +215,7 @@
 				return ze.hasMoreElements();
 			}
 
-			public Object nextElement() {
+			public JarEntry nextElement() {
 				JarEntry je = new JarEntry((ZipEntry) ze.nextElement());
 				je.parentJar = jf;
 				if (verifier != null)

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Manifest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Manifest.java?rev=410551&r1=410550&r2=410551&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Manifest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Manifest.java
Wed May 31 07:55:09 2006
@@ -36,9 +36,9 @@
 public class Manifest implements Cloneable {
 	private Attributes mainAttributes = new Attributes();
 
-	private HashMap entryAttributes = new HashMap();
+	private HashMap<String, Attributes> entryAttributes = new HashMap<String, Attributes>();
 
-	private HashMap chunks;
+	private HashMap<String, byte[]> chunks;
 
 	/*The data chunk of Main Attributes in the manifest is needed in verification.*/
 	private byte[] mainAttributesChunk;
@@ -94,7 +94,7 @@
 	 * 
 	 * @return A Map of entry attributes
 	 */
-	public Map getEntries() {
+	public Map<String, Attributes> getEntries() {
 		return entryAttributes;
 	}
 
@@ -116,7 +116,7 @@
 	 */
 	public Manifest(Manifest man) {
 		mainAttributes = (Attributes) man.mainAttributes.clone();
-		entryAttributes = (HashMap) man.entryAttributes.clone();
+		entryAttributes = (HashMap<String, Attributes>) man.entryAttributes.clone();
 	}
 
 	/**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Pack200.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Pack200.java?rev=410551&r1=410550&r2=410551&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Pack200.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Pack200.java
Wed May 31 07:55:09 2006
@@ -43,7 +43,7 @@
 	 */
 	public static Pack200.Packer newPacker() {
 		Packer packer = (Packer) AccessController
-				.doPrivileged(new PrivilegedAction() {
+				.doPrivileged(new PrivilegedAction<Object>() {
 					public Object run() {
 						String className = System
 								.getProperty(SYSTEM_PROPERTY_PACKER);
@@ -72,7 +72,7 @@
 	 */
 	public static Pack200.Unpacker newUnpacker() {
 		Unpacker unpacker = (Unpacker) AccessController
-				.doPrivileged(new PrivilegedAction() {
+				.doPrivileged(new PrivilegedAction<Object>() {
 					public Object run() {
 						String className = System
 								.getProperty(SYSTEM_PROPERTY_UNPACKER);



Mime
View raw message