You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by qi...@apache.org on 2008/08/22 09:15:27 UTC

svn commit: r687988 [9/11] - in /harmony/enhanced/classlib/branches/java6: ./ depends/build/ depends/build/platform/ depends/jars/ depends/jars/icu4jni_3.4/ depends/manifests/bcel-5.2/ depends/manifests/bcel-5.2/META-INF/ make/ modules/accessibility/ m...

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/SegmentConstantPool.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/SegmentConstantPool.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/SegmentConstantPool.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/SegmentConstantPool.java Fri Aug 22 00:15:00 2008
@@ -16,7 +16,9 @@
  */
 package org.apache.harmony.unpack200;
 
-import org.apache.harmony.unpack200.bytecode.ClassConstantPool;
+import java.util.List;
+
+import org.apache.harmony.pack200.Pack200Exception;
 import org.apache.harmony.unpack200.bytecode.ClassFileEntry;
 import org.apache.harmony.unpack200.bytecode.ConstantPoolEntry;
 
@@ -27,7 +29,7 @@
 public class SegmentConstantPool {
 
     private final CpBands bands;
-
+    private final SegmentConstantPoolArrayCache arrayCache = new SegmentConstantPoolArrayCache();
     /**
      * @param bands
      */
@@ -62,7 +64,7 @@
         } else if (index < 0) {
             throw new Pack200Exception("Cannot have a negative range");
         } else if (cp == UTF_8) {
-            return bands.cpUTF8Value(index, ClassConstantPool.DOMAIN_NORMALASCIIZ);
+            return bands.cpUTF8Value(index);
         } else if (cp == CP_INT) {
             return bands.cpIntegerValue(index);
         } else if (cp == CP_FLOAT) {
@@ -88,7 +90,7 @@
      * Subset the constant pool of the specified type to be just that which has
      * the specified class name. Answer the ConstantPoolEntry at the
      * desiredIndex of the subsetted pool.
-     * 
+     *
      * @param cp
      *            type of constant pool array to search
      * @param desiredIndex
@@ -119,7 +121,7 @@
     /**
      * Given the name of a class, answer the CPClass associated with that class.
      * Answer null if the class doesn't exist.
-     * 
+     *
      * @param name
      *            Class name to look for (form: java/lang/Object)
      * @return CPClass for that class name, or null if not found.
@@ -139,7 +141,7 @@
 
     /**
      * Answer the init method for the specified class.
-     * 
+     *
      * @param cp
      *            constant pool to search (must be CP_METHOD)
      * @param value
@@ -169,19 +171,19 @@
      * which have just those methods / fields defined in the superclass.
      * Similarly, _this bytecodes use just those methods/fields defined in this
      * class, and _init bytecodes use just those methods that start with <init>.
-     * 
+     *
      * This method takes an array of names, a String to match for, an index and
      * a boolean as parameters, and answers the array position in the array of
      * the indexth element which matches (or equals) the String (depending on
      * the state of the boolean)
-     * 
+     *
      * In other words, if the class array consists of: Object [position 0, 0th
      * instance of Object] String [position 1, 0th instance of String] String
      * [position 2, 1st instance of String] Object [position 3, 1st instance of
      * Object] Object [position 4, 2nd instance of Object] then
      * matchSpecificPoolEntryIndex(..., "Object", 2, false) will answer 4.
      * matchSpecificPoolEntryIndex(..., "String", 0, false) will answer 1.
-     * 
+     *
      * @param nameArray
      *            Array of Strings against which the compareString is tested
      * @param compareString
@@ -201,10 +203,10 @@
      * of the number of hits it finds using the following basis of comparison
      * for a hit: - the primaryArray[index] must be .equals() to the
      * primaryCompareString - the secondaryArray[index] .matches() the
-     * secondaryCompareString When the desiredIndex number of hits has been
-     * reached, the index into the original two arrays of the element hit is
-     * returned.
-     * 
+     * secondaryCompareString. When the desiredIndex number of hits
+     * has been reached, the index into the original two arrays of
+     * the element hit is returned.
+     *
      * @param primaryArray
      *            The first array to search
      * @param secondaryArray
@@ -219,22 +221,27 @@
      *         primaryArray and secondaryArray
      */
     protected int matchSpecificPoolEntryIndex(String[] primaryArray,
-            String[] secondaryArray, String primaryCompareString,
-            String secondaryCompareRegex, int desiredIndex) {
-        int instanceCount = -1;
-        for (int index = 0; index < primaryArray.length; index++) {
-            if ((primaryArray[index].equals(primaryCompareString))
-                    && regexMatches(secondaryCompareRegex,
-                            secondaryArray[index])) {
-                instanceCount++;
-                if (instanceCount == desiredIndex) {
-                    return index;
-                }
-            }
-        }
-        // We didn't return in the for loop, so the desiredMatch
-        // with desiredIndex must not exist in the array.
-        return -1;
+	    String[] secondaryArray, String primaryCompareString,
+	    String secondaryCompareRegex, int desiredIndex) {
+	int instanceCount = -1;
+	List indexList = arrayCache.indexesForArrayKey(primaryArray, primaryCompareString);
+	if(indexList.isEmpty()) {
+	    // Primary key not found, no chance of finding secondary
+	    return -1;
+	}
+
+	for(int index=0; index < indexList.size(); index++) {
+	    int arrayIndex = ((Integer)indexList.get(index)).intValue();
+	    if(regexMatches(secondaryCompareRegex, secondaryArray[arrayIndex])) {
+		instanceCount++;
+		if(instanceCount == desiredIndex) {
+		    return arrayIndex;
+		}
+	    }
+	}
+	// We didn't return in the for loop, so the desiredMatch
+	// with desiredIndex must not exist in the arrays.
+	return -1;
     }
 
     /**
@@ -244,7 +251,7 @@
      * forms we care about: .* (aka REGEX_MATCH_ALL) ^<init>.* (aka
      * REGEX_MATCH_INIT) and will answer correctly if those are passed as the
      * regexString.
-     * 
+     *
      * @param regexString
      *            String against which the compareString will be matched
      * @param compareString
@@ -276,8 +283,7 @@
         } else if (index < 0) {
             throw new Pack200Exception("Cannot have a negative range");
         } else if (cp == UTF_8) {
-            return bands.cpUTF8Value(index,
-                    ClassConstantPool.DOMAIN_NORMALASCIIZ);
+            return bands.cpUTF8Value(index);
         } else if (cp == CP_INT) {
             return bands.cpIntegerValue(index);
         } else if (cp == CP_FLOAT) {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/SegmentHeader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/SegmentHeader.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/SegmentHeader.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/SegmentHeader.java Fri Aug 22 00:15:00 2008
@@ -23,6 +23,7 @@
 
 import org.apache.harmony.pack200.BHSDCodec;
 import org.apache.harmony.pack200.Codec;
+import org.apache.harmony.pack200.Pack200Exception;
 
 /**
  * SegmentHeader is the header band of a {@link Segment}
@@ -93,8 +94,15 @@
         this.segment = segment;
     }
 
-    public void unpack(InputStream in) throws IOException, Pack200Exception,
+    public int getArchiveSizeOffset() {
+        return archiveSizeOffset;
+    }
+
+    private int archiveSizeOffset;
+
+    public void read(InputStream in) throws IOException, Pack200Exception,
             Error, Pack200Exception {
+
         long word[] = decodeScalar("archive_magic_word", in, Codec.BYTE1,
                 magic.length);
         for (int m = 0; m < magic.length; m++)
@@ -116,11 +124,17 @@
             readFully(in, bandHeaders);
             setBandHeadersData(bandHeaders);
         }
+
+        archiveSizeOffset = archiveSizeOffset - in.available();
+    }
+
+    public void unpack() {
+
     }
 
     /**
      * Sets the minor version of this archive
-     * 
+     *
      * @param version
      *            the minor version of the archive
      * @throws Pack200Exception
@@ -134,7 +148,7 @@
 
     /**
      * Sets the major version of this archive.
-     * 
+     *
      * @param version
      *            the minor version of the archive
      * @throws Pack200Exception
@@ -239,11 +253,11 @@
      * Obtain the band headers data as an input stream. If no band headers are
      * present, this will return an empty input stream to prevent any further
      * reads taking place.
-     * 
+     *
      * Note that as a stream, data consumed from this input stream can't be
      * re-used. Data is only read from this stream if the encoding is such that
      * additional information needs to be decoded from the stream itself.
-     * 
+     *
      * @return the band headers input stream
      */
     public InputStream getBandHeadersInputStream() {
@@ -271,6 +285,7 @@
         if (options.hasArchiveFileCounts()) {
             setArchiveSize(decodeScalar("archive_size_hi", in, Codec.UNSIGNED5) << 32
                     | decodeScalar("archive_size_lo", in, Codec.UNSIGNED5));
+            archiveSizeOffset = in.available();
             setSegmentsRemaining(decodeScalar("archive_next_count", in,
                     Codec.UNSIGNED5));
             setArchiveModtime(decodeScalar("archive_modtime", in,
@@ -329,7 +344,7 @@
     /**
      * Decode a number of scalars from the band file. A scalar is like a band,
      * but does not perform any band code switching.
-     * 
+     *
      * @param name
      *            the name of the scalar (primarily for logging/debugging
      *            purposes)
@@ -355,7 +370,7 @@
     /**
      * Decode a scalar from the band file. A scalar is like a band, but does not
      * perform any band code switching.
-     * 
+     *
      * @param name
      *            the name of the scalar (primarily for logging/debugging
      *            purposes)
@@ -404,7 +419,7 @@
      * Completely reads in a byte array, akin to the implementation in
      * {@link java.lang.DataInputStream}. TODO Refactor out into a separate
      * InputStream handling class
-     * 
+     *
      * @param in
      *            the input stream to read from
      * @param data

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/SegmentOptions.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/SegmentOptions.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/SegmentOptions.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/SegmentOptions.java Fri Aug 22 00:15:00 2008
@@ -16,6 +16,8 @@
  */
 package org.apache.harmony.unpack200;
 
+import org.apache.harmony.pack200.Pack200Exception;
+
 /**
  * Stores the combinations of bit flags that can be used in the segment header
  * options. Whilst this could be defined in {@link Segment}, it's cleaner to
@@ -62,7 +64,7 @@
 
     /**
      * Creates a new segment options with the given integer value.
-     * 
+     *
      * @param options
      *            the integer value to use as the flags
      * @throws Pack200Exception

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/SegmentUtils.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/SegmentUtils.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/SegmentUtils.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/SegmentUtils.java Fri Aug 22 00:15:00 2008
@@ -32,7 +32,7 @@
     /**
      * Count the number of arguments in the descriptor. Each long or double
      * counts as widthOfLongsAndDoubles; all other arguments count as 1.
-     * 
+     *
      * @param descriptor
      *            String for which arguments are counted
      * @param widthOfLongsAndDoubles
@@ -129,7 +129,7 @@
      * used instead of indexOf('$') because inner classes may be separated by
      * any character <= '$' (in other words, Foo#Bar is as valid as Foo$Bar). If
      * no $ character is found, answer -1.
-     * 
+     *
      * @param string
      *            String to search for $
      * @return first index of $ character, or -1 if not found
@@ -151,7 +151,7 @@
      * This is a debugging message to aid the developer in writing this class.
      * If the property 'debug.unpack200' is set, this will generate messages to
      * stderr; otherwise, it will be silent.
-     * 
+     *
      * @param message
      * @deprecated this may be removed from production code
      */

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/AnnotationDefaultAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/AnnotationDefaultAttribute.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/AnnotationDefaultAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/AnnotationDefaultAttribute.java Fri Aug 22 00:15:00 2008
@@ -26,8 +26,7 @@
 
     private final ElementValue element_value;
 
-    private static final CPUTF8 attributeName = new CPUTF8("AnnotationDefault",
-            ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ);
+    private static final CPUTF8 attributeName = new CPUTF8("AnnotationDefault");
 
     public AnnotationDefaultAttribute(ElementValue element_value) {
         super(attributeName);

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/Attribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/Attribute.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/Attribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/Attribute.java Fri Aug 22 00:15:00 2008
@@ -66,7 +66,7 @@
      * when attributes are nested within other attributes - the outer attribute
      * needs to take the inner attribute headers into account when calculating
      * its length.
-     * 
+     *
      * @return int adjusted length
      */
     protected int getLengthIncludingHeader() {
@@ -80,7 +80,7 @@
     /**
      * Answer true if the receiver needs to have BCI renumbering applied to it;
      * otherwise answer false.
-     * 
+     *
      * @return boolean BCI renumbering required
      */
     public boolean hasBCIRenumbering() {
@@ -90,7 +90,7 @@
     /**
      * Answer true if the receiver is a source file attribute (which gets
      * special handling when the class is built); otherwise answer false.
-     * 
+     *
      * @return boolean source file attribute
      */
     public boolean isSourceFileAttribute() {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/BCIRenumberedAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/BCIRenumberedAttribute.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/BCIRenumberedAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/BCIRenumberedAttribute.java Fri Aug 22 00:15:00 2008
@@ -20,7 +20,7 @@
 import java.io.IOException;
 import java.util.List;
 
-import org.apache.harmony.unpack200.Pack200Exception;
+import org.apache.harmony.pack200.Pack200Exception;
 
 /**
  * Abstract superclass for attributes that have some part encoded with a BCI
@@ -28,7 +28,7 @@
  */
 public abstract class BCIRenumberedAttribute extends Attribute {
 
-    protected boolean renumbered = false;
+    protected boolean renumbered;
 
     /*
      * (non-Javadoc)

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java Fri Aug 22 00:15:00 2008
@@ -28,9 +28,18 @@
 public class ByteCode extends ClassFileEntry {
 
     public static ByteCode getByteCode(int opcode) {
-        return new ByteCode(0xFF & opcode);
+        int byteOpcode = 0xFF & opcode;
+        if(ByteCodeForm.get(byteOpcode).hasNoOperand()) {
+            if(null == noArgByteCodes[byteOpcode]) {
+                noArgByteCodes[byteOpcode] = new ByteCode(byteOpcode);
+            }
+            return noArgByteCodes[byteOpcode];
+        }
+        return new ByteCode(byteOpcode);
     }
 
+    private static ByteCode[] noArgByteCodes = new ByteCode[255];
+
     private final ByteCodeForm byteCodeForm;
 
     private ClassFileEntry[] nested;
@@ -38,7 +47,7 @@
     private int[] rewrite;
 
     private int byteCodeOffset = -1;
-    private int[] byteCodeTargets = null;
+    private int[] byteCodeTargets;
 
     protected ByteCode(int opcode) {
         this(opcode, ClassFileEntry.NONE);
@@ -57,18 +66,7 @@
     }
 
     public boolean equals(Object obj) {
-        if (this == obj)
-            return true;
-        if (obj == null)
-            return false;
-        if (getClass() != obj.getClass())
-            return false;
-        final ByteCode other = (ByteCode) obj;
-        if (getByteCodeForm() != other.getByteCodeForm())
-            return false;
-        if (rewrite != other.rewrite)
-            return false;
-        return true;
+    	return this == obj;
     }
 
     public void extractOperands(OperandManager operandManager, Segment segment,
@@ -106,20 +104,22 @@
         return getByteCodeForm().getOperandType();
     }
 
+    private boolean hashcodeComputed;
+    private int cachedHashCode;
+
+    private void generateHashCode() {
+        cachedHashCode = objectHashCode();
+    }
+
     public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + getByteCodeForm().getOpcode();
-        // Don't forget to take the operands = rewrite into account
-        for (int index = 1; index < rewrite.length; index++) {
-            result = result + rewrite[index];
-        }
-        return result;
+        if (!hashcodeComputed)
+            generateHashCode();
+        return cachedHashCode;
     }
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.harmony.unpack200.bytecode.ClassFileEntry#resolve(org.apache.harmony.unpack200.bytecode.ClassConstantPool)
      */
     protected void resolve(ClassConstantPool pool) {
@@ -153,7 +153,7 @@
      * bytecode, set the rewrite bytes of the operand to be the appropriate
      * values. All values in operands[] will be masked with 0xFF so they fit
      * into a byte.
-     * 
+     *
      * @param operands
      *            int[] rewrite operand bytes
      */
@@ -181,7 +181,7 @@
      * Given an int operand, set the rewrite bytes for that position and the one
      * immediately following it to a high-byte, low-byte encoding of the
      * operand.
-     * 
+     *
      * @param operand
      *            int to set the rewrite bytes to
      * @param position
@@ -211,7 +211,7 @@
     /**
      * This is just like setOperandInt, but takes special care when the operand
      * is less than 0 to make sure it's written correctly.
-     * 
+     *
      * @param operand
      *            int to set the rewrite bytes to
      * @param position
@@ -229,7 +229,7 @@
     /**
      * Given an int operand, treat it as a byte and set the rewrite byte for
      * that position to that value. Mask of anything beyond 0xFF.
-     * 
+     *
      * @param operand
      *            int to set the rewrite byte to (unsigned)
      * @param position
@@ -267,14 +267,14 @@
      * nestedPositions is an array of arrays of ints. Each subarray specifies a
      * position of a nested element (from the nested[] array) and the length of
      * that element.
-     * 
+     *
      * For instance, one might have a nested of: {CPClass java/lang/Foo, CPFloat
      * 3.14} The nestedPositions would then be: {{0,2},{2,2}} In other words,
      * when the bytecode is resolved, the CPClass will be resolved to an int and
      * inserted at position 0 and 1 of the rewrite arguments (the first
      * occurrences of -1). The CPFloat will be resolved to an int position and
      * inserted at positions 2 and 3 of the rewrite arguments.
-     * 
+     *
      * @param nestedPositions
      */
     public void setNestedPositions(int[][] nestedPositions) {
@@ -293,7 +293,7 @@
      * This method will answer true if the receiver is a multi-bytecode
      * instruction (such as aload0_putfield_super); otherwise, it will answer
      * false.
-     * 
+     *
      * @return boolean true if multibytecode, false otherwise
      */
     public boolean hasMultipleByteCodes() {
@@ -305,10 +305,10 @@
      * particular, label byte codes need to know where they are in order to
      * calculate their targets). This method lets the CodeAttribute specify
      * where the byte code is.
-     * 
+     *
      * Since there are no aload0+label instructions, this method doesn't worry
      * about multioperation bytecodes.
-     * 
+     *
      * @param byteCodeOffset
      *            int position in code array.
      */
@@ -326,7 +326,7 @@
      * relative to the byteCodeOffset, but later get fixed up to point to the
      * absolute position in the CodeAttribute array. This method sets the
      * targets.
-     * 
+     *
      * @param byteCodeTargets
      *            int index in array
      */
@@ -352,10 +352,10 @@
      * Some bytecodes (the ones with variable lengths) can't have a static
      * rewrite array - they need the ability to update the array. This method
      * permits that.
-     * 
+     *
      * Note that this should not be called from bytecodes which have a static
      * rewrite; use the table in ByteCodeForm instead to specify those rewrites.
-     * 
+     *
      * @param rewrite
      */
     public void setRewrite(int[] rewrite) {
@@ -366,7 +366,7 @@
      * Some bytecodes (the ones with variable lengths) can't have a static
      * rewrite array - they need the ability to update the array. This method
      * permits their associated bytecode formst to query their rewrite array.
-     * 
+     *
      * Note that this should not be called from bytecodes which have a static
      * rewrite; use the table in ByteCodeForm instead to specify those rewrites.
      */

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPClass.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPClass.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPClass.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPClass.java Fri Aug 22 00:15:00 2008
@@ -32,19 +32,18 @@
 
     /**
      * Creates a new CPClass
-     * 
+     *
      * @param name
      * @throws NullPointerException
      *             if name is null
      */
     public CPClass(CPUTF8 name, int globalIndex) {
         super(ConstantPoolEntry.CP_Class, globalIndex);
-        this.name = name.underlyingString();
-        this.domain = ClassConstantPool.DOMAIN_CLASSREF;
-        this.utf8 = name;
         if (name == null) {
             throw new NullPointerException("Null arguments are not allowed");
         }
+        this.name = name.underlyingString();
+        this.utf8 = name;
     }
 
     public boolean equals(Object obj) {
@@ -62,8 +61,18 @@
         return new ClassFileEntry[] { utf8, };
     }
 
+    private boolean hashcodeComputed;
+    private int cachedHashCode;
+
+    private void generateHashCode() {
+        hashcodeComputed = true;
+        cachedHashCode = utf8.hashCode();
+    }
+
     public int hashCode() {
-        return utf8.hashCode();
+        if (!hashcodeComputed)
+            generateHashCode();
+        return cachedHashCode;
     }
 
     protected void resolve(ClassConstantPool pool) {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPConstant.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPConstant.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPConstant.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPConstant.java Fri Aug 22 00:15:00 2008
@@ -26,7 +26,7 @@
 
     /**
      * Create a new CPConstant
-     * 
+     *
      * @param tag
      * @param value
      * @throws NullPointerException

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPDouble.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPDouble.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPDouble.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPDouble.java Fri Aug 22 00:15:00 2008
@@ -26,7 +26,6 @@
 
     public CPDouble(Double value, int globalIndex) {
         super(ConstantPoolEntry.CP_Double, value, globalIndex);
-        this.domain = ClassConstantPool.DOMAIN_DOUBLE;
     }
 
     protected void writeBody(DataOutputStream dos) throws IOException {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPFieldRef.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPFieldRef.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPFieldRef.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPFieldRef.java Fri Aug 22 00:15:00 2008
@@ -31,7 +31,6 @@
 
     public CPFieldRef(CPClass className, CPNameAndType descriptor, int globalIndex) {
         super(ConstantPoolEntry.CP_Fieldref, globalIndex);
-        this.domain = ClassConstantPool.DOMAIN_FIELD;
         this.className = className;
         this.nameAndType = descriptor;
     }
@@ -55,14 +54,24 @@
         return "FieldRef: " + className + "#" + nameAndType;
     }
 
-    public int hashCode() {
+    private boolean hashcodeComputed;
+    private int cachedHashCode;
+
+    private void generateHashCode() {
+        hashcodeComputed = true;
         final int PRIME = 31;
         int result = 1;
         result = PRIME * result
                 + ((className == null) ? 0 : className.hashCode());
         result = PRIME * result
                 + ((nameAndType == null) ? 0 : nameAndType.hashCode());
-        return result;
+        cachedHashCode = result;
+    }
+
+    public int hashCode() {
+        if (!hashcodeComputed)
+            generateHashCode();
+        return cachedHashCode;
     }
 
     public boolean equals(Object obj) {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPFloat.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPFloat.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPFloat.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPFloat.java Fri Aug 22 00:15:00 2008
@@ -26,7 +26,6 @@
 
     public CPFloat(Float value, int globalIndex) {
         super(ConstantPoolEntry.CP_Float, value, globalIndex);
-        this.domain = ClassConstantPool.DOMAIN_FLOAT;
     }
 
     protected void writeBody(DataOutputStream dos) throws IOException {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPInteger.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPInteger.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPInteger.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPInteger.java Fri Aug 22 00:15:00 2008
@@ -26,7 +26,6 @@
 
     public CPInteger(Integer value, int globalIndex) {
         super(ConstantPoolEntry.CP_Integer, value, globalIndex);
-        this.domain = ClassConstantPool.DOMAIN_INTEGER;
     }
 
     protected void writeBody(DataOutputStream dos) throws IOException {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPInterfaceMethodRef.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPInterfaceMethodRef.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPInterfaceMethodRef.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPInterfaceMethodRef.java Fri Aug 22 00:15:00 2008
@@ -20,17 +20,35 @@
 
     public CPInterfaceMethodRef(CPClass className, CPNameAndType descriptor, int globalIndex) {
         super(ConstantPoolEntry.CP_InterfaceMethodref, className, descriptor, globalIndex);
-        this.domain = ClassConstantPool.DOMAIN_METHOD;
     }
 
     /**
      * This method answers the value this method will use for an invokeinterface
      * call. This is equal to 1 + the count of all the args, where longs and
      * doubles count for 2 and all others count for 1.
-     * 
+     *
      * @return integer count
      */
     public int invokeInterfaceCount() {
         return nameAndType.invokeInterfaceCount();
     }
+
+    private boolean hashcodeComputed;
+    private int cachedHashCode;
+
+    private void generateHashCode() {
+        hashcodeComputed = true;
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + className.hashCode();
+        result = PRIME * result + nameAndType.hashCode();
+        cachedHashCode = result;
+    }
+
+    public int hashCode() {
+        if (!hashcodeComputed)
+            generateHashCode();
+        return cachedHashCode;
+    }
+
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPLong.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPLong.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPLong.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPLong.java Fri Aug 22 00:15:00 2008
@@ -26,7 +26,6 @@
 
     public CPLong(Long value, int globalIndex) {
         super(ConstantPoolEntry.CP_Long, value, globalIndex);
-        this.domain = ClassConstantPool.DOMAIN_LONG;
     }
 
     protected void writeBody(DataOutputStream dos) throws IOException {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPMember.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPMember.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPMember.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPMember.java Fri Aug 22 00:15:00 2008
@@ -19,7 +19,6 @@
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -36,7 +35,7 @@
 
     /**
      * Create a new CPMember
-     * 
+     *
      * @param name
      * @param descriptor
      * @param flags
@@ -70,8 +69,8 @@
         super.resolve(pool);
         nameIndex = pool.indexOf(name);
         descriptorIndex = pool.indexOf(descriptor);
-        for (Iterator it = attributes.iterator(); it.hasNext();) {
-            Attribute attribute = (Attribute) it.next();
+        for(int it = 0; it < attributes.size(); it++) {
+            Attribute attribute = (Attribute) attributes.get(it);
             attribute.resolve(pool);
         }
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPMethod.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPMethod.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPMethod.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPMethod.java Fri Aug 22 00:15:00 2008
@@ -31,4 +31,22 @@
         return "Method: " + name + "(" + descriptor + ")";
     }
 
+    private boolean hashcodeComputed;
+    private int cachedHashCode;
+
+    private void generateHashCode() {
+        hashcodeComputed = true;
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + name.hashCode();
+        result = PRIME * result + descriptor.hashCode();
+        cachedHashCode = result;
+    }
+
+    public int hashCode() {
+        if (!hashcodeComputed)
+            generateHashCode();
+        return cachedHashCode;
+    }
+
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPMethodRef.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPMethodRef.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPMethodRef.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPMethodRef.java Fri Aug 22 00:15:00 2008
@@ -23,11 +23,29 @@
 
     public CPMethodRef(CPClass className, CPNameAndType descriptor, int globalIndex) {
         super(ConstantPoolEntry.CP_Methodref, className, descriptor, globalIndex);
-        this.domain = ClassConstantPool.DOMAIN_METHOD;
     }
 
     protected ClassFileEntry[] getNestedClassFileEntries() {
         return new ClassFileEntry[] { className, nameAndType };
     }
 
+
+    private boolean hashcodeComputed;
+    private int cachedHashCode;
+
+    private void generateHashCode() {
+        hashcodeComputed = true;
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + className.hashCode();
+        result = PRIME * result + nameAndType.hashCode();
+        cachedHashCode = result;
+    }
+
+    public int hashCode() {
+        if (!hashcodeComputed)
+            generateHashCode();
+        return cachedHashCode;
+    }
+
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPNameAndType.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPNameAndType.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPNameAndType.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPNameAndType.java Fri Aug 22 00:15:00 2008
@@ -36,18 +36,17 @@
 
     /**
      * Create a new CPNameAndType
-     * 
+     *
      * @param name
      * @param descriptor
      * @param domain
      * @throws NullPointerException
      *             if name or descriptor is null
      */
-    public CPNameAndType(CPUTF8 name, CPUTF8 descriptor, int domain, int globalIndex) {
+    public CPNameAndType(CPUTF8 name, CPUTF8 descriptor, int globalIndex) {
         super(ConstantPoolEntry.CP_NameAndType, globalIndex);
         this.name = name;
         this.descriptor = descriptor;
-        this.domain = domain;
         if (name == null || descriptor == null) {
             throw new NullPointerException("Null arguments are not allowed");
         }
@@ -77,12 +76,22 @@
         return "NameAndType: " + name + "(" + descriptor + ")";
     }
 
-    public int hashCode() {
+    private boolean hashcodeComputed;
+    private int cachedHashCode;
+
+    private void generateHashCode() {
+        hashcodeComputed = true;
         final int PRIME = 31;
         int result = 1;
         result = PRIME * result + descriptor.hashCode();
         result = PRIME * result + name.hashCode();
-        return result;
+        cachedHashCode = result;
+    }
+
+    public int hashCode() {
+        if (!hashcodeComputed)
+            generateHashCode();
+        return cachedHashCode;
     }
 
     public boolean equals(Object obj) {
@@ -104,7 +113,7 @@
      * Answers the invokeinterface count argument when the receiver is treated
      * as an invokeinterface target. This value is not meaningful if the
      * receiver is not an invokeinterface target.
-     * 
+     *
      * @return count
      */
     public int invokeInterfaceCount() {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPRef.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPRef.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPRef.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPRef.java Fri Aug 22 00:15:00 2008
@@ -33,7 +33,7 @@
 
     /**
      * Create a new CPRef
-     * 
+     *
      * @param type
      * @param className
      * @param descriptor
@@ -85,7 +85,7 @@
         classNameIndex = pool.indexOf(className);
     }
 
-    protected String cachedToString = null;
+    protected String cachedToString;
 
     public String toString() {
         if (cachedToString == null) {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPString.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPString.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPString.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPString.java Fri Aug 22 00:15:00 2008
@@ -29,7 +29,6 @@
 
     public CPString(CPUTF8 value, int globalIndex) {
         super(ConstantPoolEntry.CP_String, value, globalIndex);
-        this.domain = ClassConstantPool.DOMAIN_STRING;
         this.name = value;
     }
 
@@ -43,7 +42,7 @@
 
     /**
      * Allows the constant pool entries to resolve their nested entries
-     * 
+     *
      * @param pool
      */
     protected void resolve(ClassConstantPool pool) {
@@ -54,4 +53,21 @@
     protected ClassFileEntry[] getNestedClassFileEntries() {
         return new ClassFileEntry[] { name };
     }
+
+    private boolean hashcodeComputed;
+    private int cachedHashCode;
+
+    private void generateHashCode() {
+        hashcodeComputed = true;
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + name.hashCode();
+        cachedHashCode = result;
+    }
+
+    public int hashCode() {
+        if (!hashcodeComputed)
+            generateHashCode();
+        return cachedHashCode;
+    }
 }
\ No newline at end of file

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPUTF8.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPUTF8.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPUTF8.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CPUTF8.java Fri Aug 22 00:15:00 2008
@@ -18,7 +18,6 @@
 
 import java.io.DataOutputStream;
 import java.io.IOException;
-import java.io.UnsupportedEncodingException;
 
 /**
  * UTF8 constant pool entry, used for storing long Strings.
@@ -29,26 +28,22 @@
 
     /**
      * Creates a new CPUTF8 instance
-     * 
+     *
      * @param utf8
      * @param domain
      * @throws NullPointerException
      *             if utf8 is null
      */
-    public CPUTF8(String utf8, int domain, int globalIndex) {
+    public CPUTF8(String utf8, int globalIndex) {
         super(ConstantPoolEntry.CP_UTF8, globalIndex);
         this.utf8 = utf8;
-        this.domain = domain;
-        if (domain == ClassConstantPool.DOMAIN_UNDEFINED) {
-            throw new RuntimeException();
-        }
         if (utf8 == null) {
             throw new NullPointerException("Null arguments are not allowed");
         }
     }
 
-    public CPUTF8(String string, int domain) {
-        this(string, domain, -1);
+    public CPUTF8(String string) {
+        this(string, -1);
     }
 
     public boolean equals(Object obj) {
@@ -62,9 +57,19 @@
         return utf8.equals(other.utf8);
     }
 
-    public int hashCode() {
+    private boolean hashcodeComputed;
+    private int cachedHashCode;
+
+    private void generateHashCode() {
+        hashcodeComputed = true;
         final int PRIME = 31;
-        return PRIME + utf8.hashCode();
+        cachedHashCode = PRIME + utf8.hashCode();
+    }
+
+    public int hashCode() {
+        if (!hashcodeComputed)
+            generateHashCode();
+        return cachedHashCode;
     }
 
     public String toString() {
@@ -72,19 +77,14 @@
     }
 
     protected void writeBody(DataOutputStream dos) throws IOException {
-        byte[] bytes;
-        try {
-            // TODO Check that this is the right UTF-8 for bytes
-            bytes = utf8.getBytes("UTF-8");
-        } catch (UnsupportedEncodingException e) {
-            throw new RuntimeException("Couldn't convert string " + utf8
-                    + " to UTF-8");
-        }
-        dos.writeShort(bytes.length);
-        dos.write(bytes);
+        dos.writeUTF(utf8);
     }
 
     public String underlyingString() {
         return utf8;
     }
+
+    public void setGlobalIndex(int index) {
+        globalIndex = index;
+    }
 }
\ No newline at end of file

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassConstantPool.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassConstantPool.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassConstantPool.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassConstantPool.java Fri Aug 22 00:15:00 2008
@@ -17,11 +17,9 @@
 package org.apache.harmony.unpack200.bytecode;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.TreeSet;
@@ -33,28 +31,12 @@
  */
 public class ClassConstantPool {
 
-    // These are the domains in sorted order.
-    public static final int DOMAIN_UNDEFINED = 0;
-    public static final int DOMAIN_INTEGER = 1;
-    public static final int DOMAIN_FLOAT = 2;
-    public static final int DOMAIN_STRING = 3;
-    public static final int DOMAIN_NORMALASCIIZ = 4;
-    public static final int DOMAIN_LONG = 5;
-    public static final int DOMAIN_DOUBLE = 6;
-    public static final int DOMAIN_CLASSREF = 7;
-    public static final int DOMAIN_SIGNATUREASCIIZ = 8;
-    public static final int DOMAIN_NAMEANDTYPE = 9;
-    public static final int DOMAIN_FIELD = 10;
-    public static final int DOMAIN_METHOD = 11;
-    public static final int DOMAIN_ATTRIBUTEASCIIZ = 12;
-    public static final int NUM_DOMAINS = DOMAIN_ATTRIBUTEASCIIZ + 1;
-
     protected HashSet entriesContainsSet = new HashSet();
     protected HashSet othersContainsSet = new HashSet();
 
     private final HashSet mustStartClassPool = new HashSet();
 
-    protected Map indexCache = null;
+    protected Map indexCache;
 
     public String toString() {
         return entries.toString();
@@ -66,81 +48,71 @@
     private boolean resolved;
 
     public ClassFileEntry add(ClassFileEntry entry) {
-        // We don't want duplicates.
-        // Only add in constant pools, but resolve all types since they may
-        // introduce new constant pool entries
-        // This is a handy way to see what's adding a ClassFileEntry - set a
-        // breakpoint on the print
-        // if(entry instanceof CPLong) {
-        // org.apache.harmony.unpack200.SegmentUtils.debug("AAH:" +
-        // ((CPUTF8)entry).underlyingString());
-        // if (((CPUTF8)entry).underlyingString().indexOf('\b') != -1) {
-        // boolean halt = false;
-        // for(int index=0; index < entries.size(); index++) {
-        // ClassFileEntry foo = (ClassFileEntry)(entries.get(index));
-        // if(foo instanceof CPUTF8) {
-        // if(((CPUTF8)foo).underlyingString().matches(".*MRUBundleFileList.java.*"))
-        // {
-        // halt = true;
-        // }
-        //
-        // }
-        // }
-        // }
         if (entry instanceof ConstantPoolEntry) {
-            if (!entriesContainsSet.contains(entry)) {
-                entriesContainsSet.add(entry);
+            if (entriesContainsSet.add(entry)) {
                 entries.add(entry);
             }
         } else {
-            if (!othersContainsSet.contains(entry)) {
-                othersContainsSet.add(entry);
+            if (othersContainsSet.add(entry)) {
                 others.add(entry);
             }
         }
+
         return entry;
     }
 
     public void addNestedEntries() {
         boolean added = true;
-        while (added) {
+
+        // initial assignment
+        ArrayList parents = new ArrayList(512);
+        ArrayList children = new ArrayList(512);
+
+        // adding old entries
+        parents.addAll(entries);
+        parents.addAll(others);
+
+        // while there any parents to traverse and at least one change in target
+        // storage was made
+        while(added || parents.size() > 0) {
+
+            children.clear();
+
             int entriesOriginalSize = entries.size();
             int othersOriginalSize = others.size();
-            addNested(entries);
-            addNested(others);
-            added = !(entries.size() == entriesOriginalSize && others.size() == othersOriginalSize);
-        }
-    }
 
-    private void addNested(List classFileEntries) {
-        List newEntries = new ArrayList();
-        for (Iterator iterator = classFileEntries.iterator(); iterator
-                .hasNext();) {
-            ClassFileEntry entry = (ClassFileEntry) iterator.next();
-            ClassFileEntry[] nestedEntries = entry.getNestedClassFileEntries();
-            newEntries.addAll(Arrays.asList(nestedEntries));
-            if(entry instanceof ByteCode) {
-                if(((ByteCode)entry).nestedMustStartClassPool()) {
-                    mustStartClassPool.addAll(Arrays.asList(nestedEntries));
+            // get the parents' children and add them to buffer
+            // concurrently add parents to target storage
+            for(int indexParents = 0; indexParents < parents.size(); indexParents++) {
+                ClassFileEntry entry = (ClassFileEntry) parents.get(indexParents);
+
+                // traverse children
+                ClassFileEntry[] entryChildren = entry.getNestedClassFileEntries();
+                for(int c = 0; c < entryChildren.length; c++) {
+                    children.add(entryChildren[c]);
                 }
-            }
-        }
-        for (Iterator iterator = newEntries.iterator(); iterator.hasNext();) {
-            add((ClassFileEntry) iterator.next());
-        }
-    }
 
-    protected void initializeIndexCache() {
-        indexCache = new HashMap();
-        for (int index = 0; index < entries.size(); index++) {
-            ClassFileEntry indexEntry = (ClassFileEntry) entries.get(index);
-            if (indexCache.containsKey(indexEntry)) {
-                // key is already in there - do nothing
-                // This will happen if a long or double
-                // is the entry - they take up 2 slots.
-            } else {
-                indexCache.put(indexEntry, new Integer(index));
+                boolean isAtStart = (entry instanceof ByteCode)
+                        && ((ByteCode) entry).nestedMustStartClassPool();
+
+                if (isAtStart) {
+                    for (int c = 0; c < entryChildren.length; c++) {
+                        mustStartClassPool.add(entryChildren[c]);
+                    }
+                }
+
+                // add parent
+                add(entry);
             }
+
+            added = !(entries.size() == entriesOriginalSize && others.size() == othersOriginalSize);
+
+            // parents are not needed anymore
+            // children now become parents
+            parents.clear();
+            parents.addAll(children);
+
+
         }
     }
 
@@ -149,7 +121,7 @@
             throw new IllegalStateException(
                     "Constant pool is not yet resolved; this does not make any sense");
         if (null == indexCache) {
-            initializeIndexCache();
+            throw new IllegalStateException("Index cache is not initialized!");
         }
         Integer entryIndex = ((Integer) indexCache.get(entry));
         // If the entry isn't found, answer -1. Otherwise answer the entry.
@@ -172,20 +144,20 @@
 
     public void resolve(Segment segment) {
         initialSort();
-        Iterator it;
+        sortClassPool();
+
         resolved = true;
-        it = entries.iterator();
-        while (it.hasNext()) {
-            ClassFileEntry entry = (ClassFileEntry) it.next();
+
+        for(int it = 0; it < entries.size(); it++) {
+            ClassFileEntry entry = (ClassFileEntry) entries.get(it);
             entry.resolve(this);
         }
-        it = others.iterator();
-        while (it.hasNext()) {
-            ClassFileEntry entry = (ClassFileEntry) it.next();
+
+        for(int it = 0; it < others.size(); it++) {
+            ClassFileEntry entry = (ClassFileEntry) others.get(it);
             entry.resolve(this);
         }
 
-        sortClassPool(segment);
     }
 
     private void initialSort() {
@@ -199,17 +171,19 @@
             public int compare(Object arg0, Object arg1) {
                 return ((CPUTF8)arg0).underlyingString().compareTo(((CPUTF8)arg1).underlyingString());
             }
-            
+
         });
         TreeSet cpClassesNotInCpAll = new TreeSet(new Comparator() {
 
             public int compare(Object arg0, Object arg1) {
                 return ((CPClass)arg0).getName().compareTo(((CPClass)arg1).getName());
             }
-            
+
         });
-        for (Iterator iterator = entries.iterator(); iterator.hasNext();) {
-            ConstantPoolEntry entry = (ConstantPoolEntry) iterator.next();
+
+
+        for(int index = 0; index < entries.size(); index++) {
+            ConstantPoolEntry entry = (ConstantPoolEntry) entries.get(index);
             if(entry.getGlobalIndex() == -1) {
                 if (entry instanceof CPUTF8) {
                     cpUtf8sNotInCpAll.add(entry);
@@ -232,76 +206,76 @@
      * Answer the collection of CPClasses currently held by the ClassPoolSet.
      * This is used to calculate relevant classes when generating the set of
      * relevant inner classes (ic_relevant())
-     * 
+     *
      * @return ArrayList collection of all classes.
-     * 
+     *
      * NOTE: when this list is answered, the classes may not yet be resolved.
      */
     public List allClasses() {
-        List classesList = new ArrayList();
-        Iterator it = entries.iterator();
-        while (it.hasNext()) {
-            ConstantPoolEntry entry = (ConstantPoolEntry) it.next();
-            if (entry.getDomain() == DOMAIN_CLASSREF) {
+        List classesList = new ArrayList(entries.size());
+        for(int i = 0; i < entries.size(); i++) {
+            ConstantPoolEntry entry = (ConstantPoolEntry) entries.get(i);
+            if (entry instanceof CPClass) {
                 classesList.add(entry);
             }
         }
         return classesList;
     }
 
-    protected void sortClassPool(Segment segment) {
+    protected void sortClassPool() {
         // Now that everything has been resolved, do one
         // final sort of the class pool. This fixes up
         // references to objects which need to be at the
         // start of the class pool
 
-        // Since we resorted, need to initialize index cache
-        initializeIndexCache();
 
-        Iterator it = entries.iterator();
-        ArrayList startOfPool = new ArrayList();
-        ArrayList finalSort = new ArrayList();
-        while (it.hasNext()) {
-            ClassFileEntry nextEntry = (ClassFileEntry) it.next();
+        ArrayList startOfPool = new ArrayList(entries.size());
+        ArrayList finalSort = new ArrayList(entries.size());
+
+        for(int i = 0; i < entries.size(); i++) {
+            ClassFileEntry nextEntry = (ClassFileEntry) entries.get(i);
             if (mustStartClassPool.contains(nextEntry)) {
                 startOfPool.add(nextEntry);
             } else {
                 finalSort.add(nextEntry);
             }
         }
+
+        // copy over and rebuild the cache
+        //
+        indexCache = new HashMap();
+        int index = 0;
+
         entries.clear();
-        Iterator itStart = startOfPool.iterator();
-        while (itStart.hasNext()) {
-            ClassFileEntry entry = (ClassFileEntry) itStart.next();
-            entries.add(entry);
-            if (entry instanceof CPLong || entry instanceof CPDouble)
-                entries.add(entry); // these get 2 slots because of their size
-        }
-        it = finalSort.iterator();
-        while (it.hasNext()) {
-            ClassFileEntry entry = (ClassFileEntry) it.next();
-            entries.add(entry);
-            if (entry instanceof CPLong || entry instanceof CPDouble)
+
+        for(int itIndex = 0; itIndex < startOfPool.size(); itIndex++) {
+            ClassFileEntry entry = (ClassFileEntry) startOfPool.get(itIndex);
+            indexCache.put(entry, new Integer(index));
+
+            if (entry instanceof CPLong || entry instanceof CPDouble) {
                 entries.add(entry); // these get 2 slots because of their size
+                entries.add(entry);
+                index += 2;
+            } else {
+                entries.add(entry);
+                index += 1;
+            }
         }
 
-        // Since we re-sorted, need to initialize index cache
-        initializeIndexCache();
+        for(int itFinal = 0; itFinal < finalSort.size(); itFinal++) {
+            ClassFileEntry entry = (ClassFileEntry) finalSort.get(itFinal);
+            indexCache.put(entry, new Integer(index));
 
-        // Now that the indices have been re-sorted, need
-        // to re-resolve to update references. This should
-        // not add any new entries this time through.
-        it = entries.iterator();
-        while (it.hasNext()) {
-            ClassFileEntry entry = (ClassFileEntry) it.next();
-            entry.resolve(this);
-        }
-        // Also need to re-resolve the others.
-        it = others.iterator();
-        while (it.hasNext()) {
-            ClassFileEntry entry = (ClassFileEntry) it.next();
-            entry.resolve(this);
+            if (entry instanceof CPLong || entry instanceof CPDouble) {
+                entries.add(entry); // these get 2 slots because of their size
+                entries.add(entry);
+                index += 2;
+            } else {
+                entries.add(entry);
+                index += 1;
+            }
         }
+
     }
 
     public ClassFileEntry addWithNestedEntries(ClassFileEntry entry) {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassFileEntry.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassFileEntry.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassFileEntry.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassFileEntry.java Fri Aug 22 00:15:00 2008
@@ -39,7 +39,7 @@
 
     /**
      * Allows the constant pool entries to resolve their nested entries
-     * 
+     *
      * @param pool
      */
     protected void resolve(ClassConstantPool pool) {
@@ -50,6 +50,10 @@
         return resolved;
     }
 
+    protected int objectHashCode() {
+        return super.hashCode();
+    }
+
     public abstract String toString();
 
     public final void write(DataOutputStream dos) throws IOException {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CodeAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CodeAttribute.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CodeAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CodeAttribute.java Fri Aug 22 00:15:00 2008
@@ -19,7 +19,6 @@
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.harmony.unpack200.Segment;
@@ -34,8 +33,7 @@
     public List exceptionTable; // of ExceptionTableEntry
     public int maxLocals;
     public int maxStack;
-    private static final CPUTF8 attributeName = new CPUTF8("Code",
-            ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ);
+    private static final CPUTF8 attributeName = new CPUTF8("Code");
 
     public CodeAttribute(int maxStack, int maxLocals, byte codePacked[],
             Segment segment, OperandManager operandManager, List exceptionTable) {
@@ -90,9 +88,8 @@
 
     protected int getLength() {
         int attributesSize = 0;
-        Iterator it = attributes.iterator();
-        while (it.hasNext()) {
-            Attribute attribute = (Attribute) it.next();
+        for(int it = 0; it < attributes.size(); it++) {
+            Attribute attribute = (Attribute) attributes.get(it);
             attributesSize += attribute.getLengthIncludingHeader();
         }
         return 2 + 2 + 4 + codeLength + 2 + exceptionTable.size()
@@ -100,13 +97,13 @@
     }
 
     protected ClassFileEntry[] getNestedClassFileEntries() {
-        ArrayList nestedEntries = new ArrayList();
+        ArrayList nestedEntries = new ArrayList(attributes.size() + byteCodes.size() + 10);
         nestedEntries.add(getAttributeName());
         nestedEntries.addAll(byteCodes);
         nestedEntries.addAll(attributes);
         // Don't forget to add the ExceptionTable catch_types
-        for (Iterator iter = exceptionTable.iterator(); iter.hasNext();) {
-            ExceptionTableEntry entry = (ExceptionTableEntry) iter.next();
+        for(int iter = 0; iter < exceptionTable.size(); iter++) {
+            ExceptionTableEntry entry = (ExceptionTableEntry) exceptionTable.get(iter);
             CPClass catchType = entry.getCatchType();
             // If the catch type is null, this is a finally
             // block. If it's not null, we need to add the
@@ -123,18 +120,18 @@
 
     protected void resolve(ClassConstantPool pool) {
         super.resolve(pool);
-        Iterator it = attributes.iterator();
-        while (it.hasNext()) {
-            Attribute attribute = (Attribute) it.next();
+        for(int it = 0; it < attributes.size(); it++) {
+            Attribute attribute = (Attribute) attributes.get(it);
             attribute.resolve(pool);
         }
-        it = byteCodes.iterator();
-        while (it.hasNext()) {
-            ByteCode byteCode = (ByteCode) it.next();
+
+        for(int it = 0; it < byteCodes.size(); it++) {
+            ByteCode byteCode = (ByteCode) byteCodes.get(it);
             byteCode.resolve(pool);
         }
-        for (Iterator iter = exceptionTable.iterator(); iter.hasNext();) {
-            ExceptionTableEntry entry = (ExceptionTableEntry) iter.next();
+
+        for(int it = 0; it < exceptionTable.size(); it++) {
+            ExceptionTableEntry entry = (ExceptionTableEntry) exceptionTable.get(it);
             entry.resolve(pool);
         }
     }
@@ -146,23 +143,22 @@
     protected void writeBody(DataOutputStream dos) throws IOException {
         dos.writeShort(maxStack);
         dos.writeShort(maxLocals);
+
         dos.writeInt(codeLength);
-        Iterator it = byteCodes.iterator();
-        while (it.hasNext()) {
-            ByteCode byteCode = (ByteCode) it.next();
+        for(int it = 0; it < byteCodes.size(); it++) {
+            ByteCode byteCode = (ByteCode) byteCodes.get(it);
             byteCode.write(dos);
         }
+
         dos.writeShort(exceptionTable.size());
-        Iterator exceptionTableEntries = exceptionTable.iterator();
-        while (exceptionTableEntries.hasNext()) {
-            ExceptionTableEntry entry = (ExceptionTableEntry) exceptionTableEntries
-                    .next();
+        for(int it = 0; it < exceptionTable.size(); it++) {
+            ExceptionTableEntry entry = (ExceptionTableEntry) exceptionTable.get(it);
             entry.write(dos);
         }
+
         dos.writeShort(attributes.size());
-        it = attributes.iterator();
-        while (it.hasNext()) {
-            Attribute attribute = (Attribute) it.next();
+        for(int it = 0; it < attributes.size(); it++) {
+            Attribute attribute = (Attribute) attributes.get(it);
             attribute.write(dos);
         }
     }
@@ -191,8 +187,8 @@
     }
 
     public void renumber(List byteCodeOffsets) {
-        for (Iterator iter = exceptionTable.iterator(); iter.hasNext();) {
-            ExceptionTableEntry entry = (ExceptionTableEntry) iter.next();
+        for(int iter = 0; iter < exceptionTable.size(); iter++) {
+            ExceptionTableEntry entry = (ExceptionTableEntry) exceptionTable.get(iter);
             entry.renumber(byteCodeOffsets);
         }
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ConstantPoolEntry.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ConstantPoolEntry.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ConstantPoolEntry.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ConstantPoolEntry.java Fri Aug 22 00:15:00 2008
@@ -55,9 +55,7 @@
 
     byte tag;
 
-    protected int domain = ClassConstantPool.DOMAIN_UNDEFINED;
-
-    protected final int globalIndex;
+    protected int globalIndex;
 
     ConstantPoolEntry(byte tag, int globalIndex) {
         this.tag = tag;
@@ -70,14 +68,6 @@
         return tag;
     }
 
-    public int getDomain() {
-        return domain;
-    }
-
-    public void setDomain(int newDomain) {
-        this.domain = newDomain;
-    }
-
     public abstract int hashCode();
 
     public void doWrite(DataOutputStream dos) throws IOException {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ConstantValueAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ConstantValueAttribute.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ConstantValueAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ConstantValueAttribute.java Fri Aug 22 00:15:00 2008
@@ -29,7 +29,7 @@
     private final ClassFileEntry entry;
 
     private static final CPUTF8 attributeName = new CPUTF8(
-            "ConstantValue", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ); //$NON-NLS-1$
+            "ConstantValue"); //$NON-NLS-1$
 
     public ConstantValueAttribute(ClassFileEntry entry) {
         super(attributeName);

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/DeprecatedAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/DeprecatedAttribute.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/DeprecatedAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/DeprecatedAttribute.java Fri Aug 22 00:15:00 2008
@@ -24,8 +24,7 @@
  */
 public class DeprecatedAttribute extends Attribute {
 
-    private static final CPUTF8 attributeName = new CPUTF8("Deprecated",
-            ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ);
+    private static final CPUTF8 attributeName = new CPUTF8("Deprecated");
 
     public DeprecatedAttribute() {
         super(attributeName);
@@ -33,7 +32,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.harmony.unpack200.bytecode.Attribute#getLength()
      */
     protected int getLength() {
@@ -42,7 +41,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.harmony.unpack200.bytecode.Attribute#writeBody(java.io.DataOutputStream)
      */
     protected void writeBody(DataOutputStream dos) throws IOException {
@@ -51,7 +50,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.harmony.unpack200.bytecode.ClassFileEntry#toString()
      */
     public String toString() {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/EnclosingMethodAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/EnclosingMethodAttribute.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/EnclosingMethodAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/EnclosingMethodAttribute.java Fri Aug 22 00:15:00 2008
@@ -29,7 +29,7 @@
     private final CPClass cpClass;
     private final CPNameAndType method;
     private static final CPUTF8 attributeName = new CPUTF8(
-            "EnclosingMethod", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ); //$NON-NLS-1$
+            "EnclosingMethod"); //$NON-NLS-1$
 
     public EnclosingMethodAttribute(CPClass cpClass, CPNameAndType method) {
         super(attributeName);
@@ -47,7 +47,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.harmony.unpack200.bytecode.Attribute#getLength()
      */
     protected int getLength() {
@@ -68,7 +68,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.harmony.unpack200.bytecode.Attribute#writeBody(java.io.DataOutputStream)
      */
     protected void writeBody(DataOutputStream dos) throws IOException {
@@ -78,7 +78,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.harmony.unpack200.bytecode.ClassFileEntry#toString()
      */
     public String toString() {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionTableEntry.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionTableEntry.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionTableEntry.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionTableEntry.java Fri Aug 22 00:15:00 2008
@@ -40,10 +40,10 @@
      * either a normal one (with a Throwable as the catch_type) or a finally
      * clause (which has no catch_type). In the class file, the finally clause
      * is represented as catch_type == 0.
-     * 
+     *
      * To create a finally clause with this method, pass in null for the
      * catchType.
-     * 
+     *
      * @param startPC
      *            int
      * @param endPC

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionsAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionsAttribute.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionsAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionsAttribute.java Fri Aug 22 00:15:00 2008
@@ -26,7 +26,7 @@
 public class ExceptionsAttribute extends Attribute {
 
     private static final CPUTF8 attributeName = new CPUTF8(
-            "Exceptions", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ); //$NON-NLS-1$
+            "Exceptions"); //$NON-NLS-1$
 
     private static int hashCode(Object[] array) {
         final int prime = 31;

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/InnerClassesAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/InnerClassesAttribute.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/InnerClassesAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/InnerClassesAttribute.java Fri Aug 22 00:15:00 2008
@@ -19,7 +19,6 @@
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -28,7 +27,7 @@
 public class InnerClassesAttribute extends Attribute {
 
     private static final CPUTF8 attributeName = new CPUTF8(
-            "InnerClasses", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ); //$NON-NLS-1$
+            "InnerClasses"); //$NON-NLS-1$
 
     private static class InnerClassesEntry {
 
@@ -52,7 +51,7 @@
         /**
          * Determine the indices of the things in the receiver which point to
          * elements of the ClassConstantPool
-         * 
+         *
          * @param pool
          *            ClassConstantPool which holds the CPClass and CPUTF8
          *            objects.
@@ -138,9 +137,8 @@
 
     protected void resolve(ClassConstantPool pool) {
         super.resolve(pool);
-        Iterator it = innerClasses.iterator();
-        while (it.hasNext()) {
-            InnerClassesEntry entry = (InnerClassesEntry) it.next();
+        for(int it = 0; it < innerClasses.size(); it++) {
+            InnerClassesEntry entry = (InnerClassesEntry) innerClasses.get(it);
             entry.resolve(pool);
         }
     }
@@ -156,9 +154,9 @@
 
     protected void writeBody(DataOutputStream dos) throws IOException {
         dos.writeShort(innerClasses.size());
-        Iterator it = innerClasses.iterator();
-        while (it.hasNext()) {
-            InnerClassesEntry entry = (InnerClassesEntry) it.next();
+
+        for(int it = 0; it < innerClasses.size(); it++) {
+            InnerClassesEntry entry = (InnerClassesEntry) innerClasses.get(it);
             entry.write(dos);
         }
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LineNumberTableAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LineNumberTableAttribute.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LineNumberTableAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LineNumberTableAttribute.java Fri Aug 22 00:15:00 2008
@@ -28,7 +28,7 @@
     private final int[] start_pcs;
     private final int[] line_numbers;
     private static final CPUTF8 attributeName = new CPUTF8(
-            "LineNumberTable", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ); //$NON-NLS-1$
+            "LineNumberTable"); //$NON-NLS-1$
 
     public LineNumberTableAttribute(int line_number_table_length,
             int[] start_pcs, int[] line_numbers) {
@@ -52,7 +52,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.harmony.unpack200.bytecode.ClassFileEntry#toString()
      */
     public String toString() {
@@ -61,7 +61,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.harmony.unpack200.bytecode.Attribute#getNestedClassFileEntries()
      */
     protected ClassFileEntry[] getNestedClassFileEntries() {
@@ -75,7 +75,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.harmony.unpack200.bytecode.Attribute#resolve(org.apache.harmony.unpack200.bytecode.ClassConstantPool)
      */
     protected void resolve(ClassConstantPool pool) {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTableAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTableAttribute.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTableAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTableAttribute.java Fri Aug 22 00:15:00 2008
@@ -21,7 +21,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.harmony.unpack200.Pack200Exception;
+import org.apache.harmony.pack200.Pack200Exception;
 
 /**
  * Local variable table
@@ -38,7 +38,7 @@
     private final CPUTF8[] descriptors;
     private int codeLength;
     private static final CPUTF8 attributeName = new CPUTF8(
-            "LocalVariableTable", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ); //$NON-NLS-1$
+            "LocalVariableTable"); //$NON-NLS-1$
 
     public LocalVariableTableAttribute(int local_variable_table_length,
             int[] start_pcs, int[] lengths, CPUTF8[] names,
@@ -108,7 +108,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.harmony.unpack200.bytecode.BCIRenumberedAttribute#renumber(java.util.List)
      */
     public void renumber(List byteCodeOffsets) throws Pack200Exception {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTypeTableAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTypeTableAttribute.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTypeTableAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTypeTableAttribute.java Fri Aug 22 00:15:00 2008
@@ -21,7 +21,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.harmony.unpack200.Pack200Exception;
+import org.apache.harmony.pack200.Pack200Exception;
 
 /**
  * Local variable type table.
@@ -38,7 +38,7 @@
     private final CPUTF8[] signatures;
     private int codeLength;
     private static final CPUTF8 attributeName = new CPUTF8(
-            "LocalVariableTypeTable", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ); //$NON-NLS-1$
+            "LocalVariableTypeTable"); //$NON-NLS-1$
 
     public LocalVariableTypeTableAttribute(
             int local_variable_type_table_length, int[] start_pcs,
@@ -95,14 +95,14 @@
         nestedEntries.toArray(nestedEntryArray);
         return nestedEntryArray;
     }
-    
+
     protected int[] getStartPCs() {
         return start_pcs;
     }
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.harmony.unpack200.bytecode.BCIRenumberedAttribute#renumber(java.util.List)
      */
     public void renumber(List byteCodeOffsets) throws Pack200Exception {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/NewAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/NewAttribute.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/NewAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/NewAttribute.java Fri Aug 22 00:15:00 2008
@@ -43,20 +43,20 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.harmony.unpack200.bytecode.Attribute#getLength()
      */
     protected int getLength() {
         int length = 0;
-        for (Iterator iter = lengths.iterator(); iter.hasNext();) {
-            length += ((Integer) iter.next()).intValue();
+        for(int iter = 0; iter < lengths.size(); iter++) {
+            length += ((Integer)lengths.get(iter)).intValue();
         }
         return length;
     }
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.harmony.unpack200.bytecode.Attribute#writeBody(java.io.DataOutputStream)
      */
     protected void writeBody(DataOutputStream dos) throws IOException {
@@ -86,7 +86,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.harmony.unpack200.bytecode.ClassFileEntry#toString()
      */
     public String toString() {
@@ -150,8 +150,8 @@
 
     protected void resolve(ClassConstantPool pool) {
         super.resolve(pool);
-        for (Iterator iter = body.iterator(); iter.hasNext();) {
-            Object element = iter.next();
+        for(int iter = 0; iter < body.size(); iter++) {
+            Object element = body.get(iter);
             if (element instanceof ClassFileEntry) {
                 ((ClassFileEntry) element).resolve(pool);
             }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/OperandManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/OperandManager.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/OperandManager.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/OperandManager.java Fri Aug 22 00:15:00 2008
@@ -49,33 +49,33 @@
     int[] bcInitRef;
     int[] wideByteCodes;
 
-    int bcCaseCountIndex = 0;
-    int bcCaseValueIndex = 0;
-    int bcByteIndex = 0;
-    int bcShortIndex = 0;
-    int bcLocalIndex = 0;
-    int bcLabelIndex = 0;
-    int bcIntRefIndex = 0;
-    int bcFloatRefIndex = 0;
-    int bcLongRefIndex = 0;
-    int bcDoubleRefIndex = 0;
-    int bcStringRefIndex = 0;
-    int bcClassRefIndex = 0;
-    int bcFieldRefIndex = 0;
-    int bcMethodRefIndex = 0;
-    int bcIMethodRefIndex = 0;
-    int bcThisFieldIndex = 0;
-    int bcSuperFieldIndex = 0;
-    int bcThisMethodIndex = 0;
-    int bcSuperMethodIndex = 0;
-    int bcInitRefIndex = 0;
-    int wideByteCodeIndex = 0;
-
-    Segment segment = null;
-
-    String currentClass = null;
-    String superClass = null;
-    String newClass = null;
+    int bcCaseCountIndex;
+    int bcCaseValueIndex;
+    int bcByteIndex;
+    int bcShortIndex;
+    int bcLocalIndex;
+    int bcLabelIndex;
+    int bcIntRefIndex;
+    int bcFloatRefIndex;
+    int bcLongRefIndex;
+    int bcDoubleRefIndex;
+    int bcStringRefIndex;
+    int bcClassRefIndex;
+    int bcFieldRefIndex;
+    int bcMethodRefIndex;
+    int bcIMethodRefIndex;
+    int bcThisFieldIndex;
+    int bcSuperFieldIndex;
+    int bcThisMethodIndex;
+    int bcSuperMethodIndex;
+    int bcInitRefIndex;
+    int wideByteCodeIndex;
+
+    Segment segment;
+
+    String currentClass;
+    String superClass;
+    String newClass;
 
     public OperandManager(int[] bcCaseCount, int[] bcCaseValue, int[] bcByte,
             int[] bcShort, int[] bcLocal, int[] bcLabel, int[] bcIntRef,