Index: main/java/org/apache/harmony/pack200/bytecode/ClassConstantPool.java =================================================================== --- main/java/org/apache/harmony/pack200/bytecode/ClassConstantPool.java (revision 611913) +++ main/java/org/apache/harmony/pack200/bytecode/ClassConstantPool.java (working copy) @@ -17,16 +17,10 @@ package org.apache.harmony.pack200.bytecode; import java.util.ArrayList; -import java.util.Arrays; import java.util.Comparator; -import java.util.HashMap; import java.util.Iterator; import java.util.List; -import java.util.SortedSet; -import java.util.TreeSet; -import org.apache.harmony.pack200.bytecode.ConstantPoolEntry; -import org.apache.harmony.pack200.Pack200Exception; import org.apache.harmony.pack200.Segment; import org.apache.harmony.pack200.SegmentUtils; Index: main/java/org/apache/harmony/pack200/bytecode/CodeAttribute.java =================================================================== --- main/java/org/apache/harmony/pack200/bytecode/CodeAttribute.java (revision 611913) +++ main/java/org/apache/harmony/pack200/bytecode/CodeAttribute.java (working copy) @@ -42,11 +42,13 @@ this.codeLength = 0; this.exceptionTable = exceptionTable; byteCodeOffsets.add(new Integer(0)); + int byteCodeIndex = 0; for (int i = 0; i < codePacked.length; i++) { ByteCode byteCode = ByteCode.getByteCode(codePacked[i] & 0xff); // Setting the offset must happen before extracting operands // because label bytecodes need to know their offsets. - byteCode.setByteCodeIndex(i); + byteCode.setByteCodeIndex(byteCodeIndex); + byteCodeIndex++; byteCode.extractOperands(operandManager, segment, codeLength); byteCodes.add(byteCode); codeLength += byteCode.getLength(); @@ -57,6 +59,7 @@ // another bytecode. if (byteCode.hasMultipleByteCodes()) { byteCodeOffsets.add(new Integer(lastBytecodePosition + 1)); + byteCodeIndex++; } // I've already added the first element (at 0) before // entering this loop, so make sure I don't add one Index: main/java/org/apache/harmony/pack200/bytecode/forms/LabelForm.java =================================================================== --- main/java/org/apache/harmony/pack200/bytecode/forms/LabelForm.java (revision 611913) +++ main/java/org/apache/harmony/pack200/bytecode/forms/LabelForm.java (working copy) @@ -59,7 +59,6 @@ int sourceValue = ((Integer)codeAttribute.byteCodeOffsets.get(sourceIndex)).intValue(); // The operand is the difference between the source instruction // and the destination instruction. - // TODO: Probably have to do something other than setOperandInt if this is widened. byteCode.setOperandSigned2Bytes(targetValue - sourceValue, 0); if(widened) { byteCode.setNestedPositions(new int[][] {{0,4}}); Index: main/java/org/apache/harmony/pack200/bytecode/forms/ClassRefForm.java =================================================================== --- main/java/org/apache/harmony/pack200/bytecode/forms/ClassRefForm.java (revision 611913) +++ main/java/org/apache/harmony/pack200/bytecode/forms/ClassRefForm.java (working copy) @@ -16,10 +16,7 @@ */ package org.apache.harmony.pack200.bytecode.forms; -import org.apache.harmony.pack200.Pack200Exception; import org.apache.harmony.pack200.SegmentConstantPool; -import org.apache.harmony.pack200.bytecode.ByteCode; -import org.apache.harmony.pack200.bytecode.ClassFileEntry; import org.apache.harmony.pack200.bytecode.OperandManager; /**