harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjanu...@apache.org
Subject svn commit: r647100 [8/9] - in /harmony/enhanced/classlib/trunk/modules/pack200/src: main/java/org/apache/harmony/pack200/ main/java/org/apache/harmony/pack200/bytecode/ main/java/org/apache/harmony/pack200/bytecode/forms/ test/java/org/apache/harmony/...
Date Fri, 11 Apr 2008 10:10:00 GMT
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/StringRefForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/StringRefForm.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/StringRefForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/StringRefForm.java Fri Apr 11 03:09:38 2008
@@ -24,9 +24,8 @@
 import org.apache.harmony.pack200.bytecode.OperandManager;
 
 /**
- * This class implements the byte code form for those
- * bytecodes which have string references (and only
- * string references).
+ * This class implements the byte code form for those bytecodes which have
+ * string references (and only string references).
  */
 public class StringRefForm extends SingleByteReferenceForm {
 
@@ -55,18 +54,19 @@
         return SegmentConstantPool.CP_STRING;
     }
 
-    protected void setNestedEntries(ByteCode byteCode, OperandManager operandManager, int offset) throws Pack200Exception {
-        final SegmentConstantPool globalPool = operandManager.globalConstantPool();
+    protected void setNestedEntries(ByteCode byteCode,
+            OperandManager operandManager, int offset) throws Pack200Exception {
+        final SegmentConstantPool globalPool = operandManager
+                .globalConstantPool();
         ClassFileEntry[] nested = null;
-        nested = new ClassFileEntry[] {
-                ((CPString)globalPool.getValue(getPoolID(), offset))
-                };
+        nested = new ClassFileEntry[] { ((CPString) globalPool.getValue(
+                getPoolID(), offset)) };
         byteCode.setNested(nested);
-        if(widened) {
-            byteCode.setNestedPositions(new int[][]{{0, 2}});
+        if (widened) {
+            byteCode.setNestedPositions(new int[][] { { 0, 2 } });
         } else {
-            byteCode.setNestedPositions(new int[][]{{0, 1}});
-            ((CPString)nested[0]).mustStartClassPool(true);
+            byteCode.setNestedPositions(new int[][] { { 0, 1 } });
+            ((CPString) nested[0]).mustStartClassPool(true);
         }
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SuperFieldRefForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SuperFieldRefForm.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SuperFieldRefForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SuperFieldRefForm.java Fri Apr 11 03:09:38 2008
@@ -20,16 +20,14 @@
 import org.apache.harmony.pack200.bytecode.OperandManager;
 
 /**
- * This class implements references to fields defined
- * in the superclass, which is set by this class in the
- * OperandManager. Pack200 allows the superclass to be
- * inferred from context; this class tracks previous
- * field reference superclasses to allow this.
+ * This class implements references to fields defined in the superclass, which
+ * is set by this class in the OperandManager. Pack200 allows the superclass to
+ * be inferred from context; this class tracks previous field reference
+ * superclasses to allow this.
  */
 public class SuperFieldRefForm extends ClassSpecificReferenceForm {
 
-    public SuperFieldRefForm(int opcode, String name,
-            int[] rewrite) {
+    public SuperFieldRefForm(int opcode, String name, int[] rewrite) {
         super(opcode, name, rewrite);
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SuperInitMethodRefForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SuperInitMethodRefForm.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SuperInitMethodRefForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SuperInitMethodRefForm.java Fri Apr 11 03:09:38 2008
@@ -16,15 +16,13 @@
  */
 package org.apache.harmony.pack200.bytecode.forms;
 
-
 /**
- * This class is used to determine which init method should
- * be called, based on the last superclass reference.
+ * This class is used to determine which init method should be called, based on
+ * the last superclass reference.
  */
 public class SuperInitMethodRefForm extends InitMethodReferenceForm {
 
-    public SuperInitMethodRefForm(int opcode, String name,
-            int[] rewrite) {
+    public SuperInitMethodRefForm(int opcode, String name, int[] rewrite) {
         super(opcode, name, rewrite);
     }
 
@@ -36,7 +34,8 @@
         return true;
     }
 
-    protected String context(org.apache.harmony.pack200.bytecode.OperandManager operandManager) {
+    protected String context(
+            org.apache.harmony.pack200.bytecode.OperandManager operandManager) {
         return operandManager.getSuperClass();
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SuperMethodRefForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SuperMethodRefForm.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SuperMethodRefForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SuperMethodRefForm.java Fri Apr 11 03:09:38 2008
@@ -20,16 +20,14 @@
 import org.apache.harmony.pack200.bytecode.OperandManager;
 
 /**
- * This class implements references to methods defined
- * in the superclass, which is set by this class in the
- * OperandManager. Pack200 allows the superclass to be
- * inferred from context; this class tracks previous
- * method reference superclasses to allow this.
+ * This class implements references to methods defined in the superclass, which
+ * is set by this class in the OperandManager. Pack200 allows the superclass to
+ * be inferred from context; this class tracks previous method reference
+ * superclasses to allow this.
  */
 public class SuperMethodRefForm extends ClassSpecificReferenceForm {
 
-    public SuperMethodRefForm(int opcode, String name,
-            int[] rewrite) {
+    public SuperMethodRefForm(int opcode, String name, int[] rewrite) {
         super(opcode, name, rewrite);
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SwitchForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SwitchForm.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SwitchForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SwitchForm.java Fri Apr 11 03:09:38 2008
@@ -38,31 +38,42 @@
         return true;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.harmony.pack200.bytecode.forms.ByteCodeForm#setByteCodeOperands(org.apache.harmony.pack200.bytecode.ByteCode, org.apache.harmony.pack200.bytecode.OperandTable, org.apache.harmony.pack200.SegmentConstantPool)
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.harmony.pack200.bytecode.forms.ByteCodeForm#setByteCodeOperands(org.apache.harmony.pack200.bytecode.ByteCode,
+     *      org.apache.harmony.pack200.bytecode.OperandTable,
+     *      org.apache.harmony.pack200.SegmentConstantPool)
      */
     public void setByteCodeOperands(ByteCode byteCode,
             OperandManager operandManager, int codeLength) {
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.harmony.pack200.bytecode.forms.ByteCodeForm#fixUpByteCodeTargets(org.apache.harmony.pack200.bytecode.ByteCode, org.apache.harmony.pack200.bytecode.CodeAttribute)
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.harmony.pack200.bytecode.forms.ByteCodeForm#fixUpByteCodeTargets(org.apache.harmony.pack200.bytecode.ByteCode,
+     *      org.apache.harmony.pack200.bytecode.CodeAttribute)
      */
-    public void fixUpByteCodeTargets(ByteCode byteCode, CodeAttribute codeAttribute) {
+    public void fixUpByteCodeTargets(ByteCode byteCode,
+            CodeAttribute codeAttribute) {
         // SwitchForms need to fix up the target of label operations
         final int[] originalTargets = byteCode.getByteCodeTargets();
         final int numberOfLabels = originalTargets.length;
         final int[] replacementTargets = new int[numberOfLabels];
 
         final int sourceIndex = byteCode.getByteCodeIndex();
-        final int sourceValue = ((Integer)codeAttribute.byteCodeOffsets.get(sourceIndex)).intValue();
-        for(int index=0; index < numberOfLabels; index++) {
-            final int absoluteInstructionTargetIndex = sourceIndex + originalTargets[index];
-            final int targetValue = ((Integer)codeAttribute.byteCodeOffsets.get(absoluteInstructionTargetIndex)).intValue();
+        final int sourceValue = ((Integer) codeAttribute.byteCodeOffsets
+                .get(sourceIndex)).intValue();
+        for (int index = 0; index < numberOfLabels; index++) {
+            final int absoluteInstructionTargetIndex = sourceIndex
+                    + originalTargets[index];
+            final int targetValue = ((Integer) codeAttribute.byteCodeOffsets
+                    .get(absoluteInstructionTargetIndex)).intValue();
             replacementTargets[index] = targetValue - sourceValue;
         }
         final int[] rewriteArray = byteCode.getRewrite();
-        for(int index=0; index < numberOfLabels; index++) {
+        for (int index = 0; index < numberOfLabels; index++) {
             setRewrite4Bytes(replacementTargets[index], rewriteArray);
         }
     }

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/TableSwitchForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/TableSwitchForm.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/TableSwitchForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/TableSwitchForm.java Fri Apr 11 03:09:38 2008
@@ -29,9 +29,11 @@
         super(opcode, name, rewrite);
     }
 
-
-    /* (non-Javadoc)
-     * @see org.apache.harmony.pack200.bytecode.forms.SwitchForm#setByteCodeOperands(org.apache.harmony.pack200.bytecode.ByteCode, org.apache.harmony.pack200.bytecode.OperandManager, int)
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.harmony.pack200.bytecode.forms.SwitchForm#setByteCodeOperands(org.apache.harmony.pack200.bytecode.ByteCode,
+     *      org.apache.harmony.pack200.bytecode.OperandManager, int)
      */
     public void setByteCodeOperands(ByteCode byteCode,
             OperandManager operandManager, int codeLength) {
@@ -41,14 +43,14 @@
         case_value = operandManager.nextCaseValues();
 
         final int case_pcs[] = new int[case_count];
-        for(int index=0; index < case_count; index++) {
+        for (int index = 0; index < case_count; index++) {
             case_pcs[index] = operandManager.nextLabel();
         }
 
         final int[] labelsArray = new int[case_count + 1];
         labelsArray[0] = default_pc;
-        for(int index=1; index < case_count + 1; index++) {
-            labelsArray[index] = case_pcs[index-1];
+        for (int index = 1; index < case_count + 1; index++) {
+            labelsArray[index] = case_pcs[index - 1];
         }
         byteCode.setByteCodeTargets(labelsArray);
 
@@ -57,7 +59,6 @@
         // All this gets dumped into the rewrite bytes of the
         // poor bytecode.
 
-
         // Unlike most byte codes, the TableSwitch is a
         // variable-sized bytecode. Because of this, the
         // rewrite array has to be defined here individually
@@ -69,9 +70,9 @@
         // label is on a 4-byte offset.
         final int padLength = 3 - (codeLength % 4);
         final int rewriteSize = 1 + padLength + 4 // defaultbytes
-            + 4 // lowbyte
-            + 4 // highbyte
-            + (4 * case_pcs.length);
+                + 4 // lowbyte
+                + 4 // highbyte
+                + (4 * case_pcs.length);
 
         final int[] newRewrite = new int[rewriteSize];
         int rewriteIndex = 0;
@@ -81,7 +82,7 @@
         newRewrite[rewriteIndex++] = byteCode.getOpcode();
 
         // padding
-        for(int index=0; index < padLength; index++) {
+        for (int index = 0; index < padLength; index++) {
             newRewrite[rewriteIndex++] = 0;
         }
 
@@ -104,7 +105,7 @@
 
         // jump offsets
         // The case_pcs will get overwritten by fixUpByteCodeTargets
-        for(int index = 0; index < case_count; index++) {
+        for (int index = 0; index < case_count; index++) {
             // offset
             newRewrite[rewriteIndex++] = -1;
             newRewrite[rewriteIndex++] = -1;

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ThisFieldRefForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ThisFieldRefForm.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ThisFieldRefForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ThisFieldRefForm.java Fri Apr 11 03:09:38 2008
@@ -20,16 +20,14 @@
 import org.apache.harmony.pack200.bytecode.OperandManager;
 
 /**
- * This class implements references to fields defined
- * in the current class, which is set by this class in the
- * OperandManager. Pack200 allows the current class to be
- * inferred from context; this class tracks previous
- * field reference classes to allow this.
+ * This class implements references to fields defined in the current class,
+ * which is set by this class in the OperandManager. Pack200 allows the current
+ * class to be inferred from context; this class tracks previous field reference
+ * classes to allow this.
  */
 public class ThisFieldRefForm extends ClassSpecificReferenceForm {
 
-    public ThisFieldRefForm(int opcode, String name,
-            int[] rewrite) {
+    public ThisFieldRefForm(int opcode, String name, int[] rewrite) {
         super(opcode, name, rewrite);
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ThisInitMethodRefForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ThisInitMethodRefForm.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ThisInitMethodRefForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ThisInitMethodRefForm.java Fri Apr 11 03:09:38 2008
@@ -19,13 +19,12 @@
 import org.apache.harmony.pack200.bytecode.OperandManager;
 
 /**
- * This class is used to determine which init method should
- * be called, based on the last current class reference.
+ * This class is used to determine which init method should be called, based on
+ * the last current class reference.
  */
 public class ThisInitMethodRefForm extends InitMethodReferenceForm {
 
-    public ThisInitMethodRefForm(int opcode, String name,
-            int[] rewrite) {
+    public ThisInitMethodRefForm(int opcode, String name, int[] rewrite) {
         super(opcode, name, rewrite);
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ThisMethodRefForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ThisMethodRefForm.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ThisMethodRefForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ThisMethodRefForm.java Fri Apr 11 03:09:38 2008
@@ -20,16 +20,14 @@
 import org.apache.harmony.pack200.bytecode.OperandManager;
 
 /**
- * This class implements references to methods defined
- * in the current class, which is set by this class in the
- * OperandManager. Pack200 allows the current class to be
- * inferred from context; this class tracks previous
- * method reference current classes to allow this.
+ * This class implements references to methods defined in the current class,
+ * which is set by this class in the OperandManager. Pack200 allows the current
+ * class to be inferred from context; this class tracks previous method
+ * reference current classes to allow this.
  */
 public class ThisMethodRefForm extends ClassSpecificReferenceForm {
 
-    public ThisMethodRefForm(int opcode, String name,
-            int[] rewrite) {
+    public ThisMethodRefForm(int opcode, String name, int[] rewrite) {
         super(opcode, name, rewrite);
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/VariableInstructionForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/VariableInstructionForm.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/VariableInstructionForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/VariableInstructionForm.java Fri Apr 11 03:09:38 2008
@@ -17,10 +17,9 @@
 package org.apache.harmony.pack200.bytecode.forms;
 
 /**
- * This abstract class implements the common code for
- * instructions which have variable lengths. This
- * is currently the *switch instructions and some
- * wide (_w) instructions.
+ * This abstract class implements the common code for instructions which have
+ * variable lengths. This is currently the *switch instructions and some wide
+ * (_w) instructions.
  */
 public abstract class VariableInstructionForm extends ByteCodeForm {
 
@@ -33,36 +32,31 @@
     }
 
     /**
-     * Given an int operand, set the rewrite bytes for
-     * the next available operand position and the three
-     * immediately following it to a highest-byte,
-     * mid-high, mid-low, low-byte encoding of the operand.
-     *
-     *  Note that unlike the ByteCode setOperand* operations, this
-     *  starts with an actual bytecode rewrite array (rather than
-     *  a ByteCodeForm prototype rewrite array). Also, this method
-     *  overwrites -1 values in the rewrite array - so if you start
-     *  with an array that looks like:
-     *  {100, -1, -1, -1, -1, 200, -1, -1, -1, -1} then calling
-     *  setRewrite4Bytes(0, rewrite) the first time will convert
-     *  it to:
-     *  {100, 0, 0, 0, 0, 200, -1, -1, -1, -1}
-     *  Calling setRewrite4Bytes(0, rewrite) a second time will
-     *  convert it to:
-     *  {100, 0, 0, 0, 0, 200, 0, 0, 0, 0}
-     *
-     * @param operand int to set the rewrite bytes to
-     * @param rewrite int[] bytes to rewrite
+     * Given an int operand, set the rewrite bytes for the next available
+     * operand position and the three immediately following it to a
+     * highest-byte, mid-high, mid-low, low-byte encoding of the operand.
+     * 
+     * Note that unlike the ByteCode setOperand* operations, this starts with an
+     * actual bytecode rewrite array (rather than a ByteCodeForm prototype
+     * rewrite array). Also, this method overwrites -1 values in the rewrite
+     * array - so if you start with an array that looks like: {100, -1, -1, -1,
+     * -1, 200, -1, -1, -1, -1} then calling setRewrite4Bytes(0, rewrite) the
+     * first time will convert it to: {100, 0, 0, 0, 0, 200, -1, -1, -1, -1}
+     * Calling setRewrite4Bytes(0, rewrite) a second time will convert it to:
+     * {100, 0, 0, 0, 0, 200, 0, 0, 0, 0}
+     * 
+     * @param operand
+     *            int to set the rewrite bytes to
+     * @param rewrite
+     *            int[] bytes to rewrite
      */
     public void setRewrite4Bytes(int operand, int[] rewrite) {
         int firstOperandPosition = -1;
 
         // Find the first -1 in the rewrite array
-        for(int index=0; index < rewrite.length - 3; index++) {
-            if((rewrite[index] == -1)
-                    && (rewrite[index+1] == -1)
-                    && (rewrite[index+2] == -1)
-                    && (rewrite[index+3] == -1)) {
+        for (int index = 0; index < rewrite.length - 3; index++) {
+            if ((rewrite[index] == -1) && (rewrite[index + 1] == -1)
+                    && (rewrite[index + 2] == -1) && (rewrite[index + 3] == -1)) {
                 firstOperandPosition = index;
                 break;
             }
@@ -71,34 +65,30 @@
     }
 
     /**
-     * Given an int operand, set the rewrite bytes for
-     * the next available operand position and the byte
-     * immediately following it to a high-byte,
+     * Given an int operand, set the rewrite bytes for the next available
+     * operand position and the byte immediately following it to a high-byte,
      * low-byte encoding of the operand.
-     *
-     *  Note that unlike the ByteCode setOperand* operations, this
-     *  starts with an actual bytecode rewrite array (rather than
-     *  a ByteCodeForm prototype rewrite array). Also, this method
-     *  overwrites -1 values in the rewrite array - so if you start
-     *  with an array that looks like:
-     *  {100, -1, -1, -1, -1, 200, -1, -1, -1, -1} then calling
-     *  setRewrite2Bytes(0, rewrite) the first time will convert
-     *  it to:
-     *  {100, 0, 0, -1, -1, 200, -1, -1, -1, -1}
-     *  Calling setRewrite2Bytes(0, rewrite) a second time will
-     *  convert it to:
-     *  {100, 0, 0, 0, 0, 200, -1, -1, -1, -1}
-     *
-     * @param operand int to set the rewrite bytes to
-     * @param rewrite int[] bytes to rewrite
+     * 
+     * Note that unlike the ByteCode setOperand* operations, this starts with an
+     * actual bytecode rewrite array (rather than a ByteCodeForm prototype
+     * rewrite array). Also, this method overwrites -1 values in the rewrite
+     * array - so if you start with an array that looks like: {100, -1, -1, -1,
+     * -1, 200, -1, -1, -1, -1} then calling setRewrite2Bytes(0, rewrite) the
+     * first time will convert it to: {100, 0, 0, -1, -1, 200, -1, -1, -1, -1}
+     * Calling setRewrite2Bytes(0, rewrite) a second time will convert it to:
+     * {100, 0, 0, 0, 0, 200, -1, -1, -1, -1}
+     * 
+     * @param operand
+     *            int to set the rewrite bytes to
+     * @param rewrite
+     *            int[] bytes to rewrite
      */
     public void setRewrite2Bytes(int operand, int[] rewrite) {
         int firstOperandPosition = -1;
 
         // Find the first -1 in the rewrite array
-        for(int index=0; index < rewrite.length - 3; index++) {
-            if((rewrite[index] == -1)
-                    && (rewrite[index+1] == -1)) {
+        for (int index = 0; index < rewrite.length - 3; index++) {
+            if ((rewrite[index] == -1) && (rewrite[index + 1] == -1)) {
                 firstOperandPosition = index;
                 break;
             }
@@ -107,23 +97,30 @@
     }
 
     /**
-     * This method writes operand directly into the rewrite
-     * array at index position specified.
-     * @param operand value to write
-     * @param absPosition position in array to write. Note that
-     *   this is absolute position in the array, so one can
-     *   overwrite the bytecode if one isn't careful.
-     * @param rewrite array to write into
+     * This method writes operand directly into the rewrite array at index
+     * position specified.
+     * 
+     * @param operand
+     *            value to write
+     * @param absPosition
+     *            position in array to write. Note that this is absolute
+     *            position in the array, so one can overwrite the bytecode if
+     *            one isn't careful.
+     * @param rewrite
+     *            array to write into
      */
     public void setRewrite4Bytes(int operand, int absPosition, int[] rewrite) {
-        if(absPosition < 0) {
-            throw new Error("Trying to rewrite " + this + " but there is no room for 4 bytes");
+        if (absPosition < 0) {
+            throw new Error("Trying to rewrite " + this
+                    + " but there is no room for 4 bytes");
         }
 
         final int byteCodeRewriteLength = rewrite.length;
 
-        if(absPosition + 3 > byteCodeRewriteLength) {
-            throw new Error("Trying to rewrite " + this + " with an int at position " + absPosition + " but this won't fit in the rewrite array");
+        if (absPosition + 3 > byteCodeRewriteLength) {
+            throw new Error("Trying to rewrite " + this
+                    + " with an int at position " + absPosition
+                    + " but this won't fit in the rewrite array");
         }
 
         rewrite[absPosition] = ((0xFF000000) & operand) >> 24;
@@ -133,23 +130,30 @@
     }
 
     /**
-     * This method writes operand directly into the rewrite
-     * array at index position specified.
-     * @param operand value to write
-     * @param absPosition position in array to write. Note that
-     *   this is absolute position in the array, so one can
-     *   overwrite the bytecode if one isn't careful.
-     * @param rewrite array to write into
+     * This method writes operand directly into the rewrite array at index
+     * position specified.
+     * 
+     * @param operand
+     *            value to write
+     * @param absPosition
+     *            position in array to write. Note that this is absolute
+     *            position in the array, so one can overwrite the bytecode if
+     *            one isn't careful.
+     * @param rewrite
+     *            array to write into
      */
     public void setRewrite2Bytes(int operand, int absPosition, int[] rewrite) {
-        if(absPosition < 0) {
-            throw new Error("Trying to rewrite " + this + " but there is no room for 4 bytes");
+        if (absPosition < 0) {
+            throw new Error("Trying to rewrite " + this
+                    + " but there is no room for 4 bytes");
         }
 
         final int byteCodeRewriteLength = rewrite.length;
 
-        if(absPosition + 1 > byteCodeRewriteLength) {
-            throw new Error("Trying to rewrite " + this + " with an int at position " + absPosition + " but this won't fit in the rewrite array");
+        if (absPosition + 1 > byteCodeRewriteLength) {
+            throw new Error("Trying to rewrite " + this
+                    + " with an int at position " + absPosition
+                    + " but this won't fit in the rewrite array");
         }
 
         rewrite[absPosition] = ((0xFF00) & operand) >> 8;

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/WideForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/WideForm.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/WideForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/WideForm.java Fri Apr 11 03:09:38 2008
@@ -20,9 +20,8 @@
 import org.apache.harmony.pack200.bytecode.OperandManager;
 
 /**
- * This class implements the byte code form for the
- * wide instruction. Unlike other instructions, it
- * can take multiple forms, depending on what is being
+ * This class implements the byte code form for the wide instruction. Unlike
+ * other instructions, it can take multiple forms, depending on what is being
  * widened.
  */
 public class WideForm extends VariableInstructionForm {
@@ -43,30 +42,41 @@
         return true;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.harmony.pack200.bytecode.forms.ByteCodeForm#setByteCodeOperands(org.apache.harmony.pack200.bytecode.ByteCode, org.apache.harmony.pack200.bytecode.OperandTable, org.apache.harmony.pack200.SegmentConstantPool)
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.harmony.pack200.bytecode.forms.ByteCodeForm#setByteCodeOperands(org.apache.harmony.pack200.bytecode.ByteCode,
+     *      org.apache.harmony.pack200.bytecode.OperandTable,
+     *      org.apache.harmony.pack200.SegmentConstantPool)
      */
     public void setByteCodeOperands(ByteCode byteCode,
             OperandManager operandManager, int codeLength) {
         final int instruction = operandManager.nextWideByteCode();
-        if(instruction == 132) {
-            setByteCodeOperandsFormat2(instruction, byteCode, operandManager, codeLength);
+        if (instruction == 132) {
+            setByteCodeOperandsFormat2(instruction, byteCode, operandManager,
+                    codeLength);
         } else {
-            setByteCodeOperandsFormat1(instruction, byteCode, operandManager, codeLength);
+            setByteCodeOperandsFormat1(instruction, byteCode, operandManager,
+                    codeLength);
         }
     }
 
     /**
-     * This method sets the rewrite array for the bytecode
-     * using Format 1 of the JVM spec: an opcode and two index
-     * bytes. This is used for ?load/?store/ret
-     * @param instruction should be 132
-     * @param byteCode the byte code whose rewrite array should be updated
-     * @param operandManager the source of the operands
-     * @param codeLength ignored
+     * This method sets the rewrite array for the bytecode using Format 1 of the
+     * JVM spec: an opcode and two index bytes. This is used for
+     * ?load/?store/ret
+     * 
+     * @param instruction
+     *            should be 132
+     * @param byteCode
+     *            the byte code whose rewrite array should be updated
+     * @param operandManager
+     *            the source of the operands
+     * @param codeLength
+     *            ignored
      */
-    protected void setByteCodeOperandsFormat1(int instruction, ByteCode byteCode,
-            OperandManager operandManager, int codeLength) {
+    protected void setByteCodeOperandsFormat1(int instruction,
+            ByteCode byteCode, OperandManager operandManager, int codeLength) {
 
         // Even though this code is really similar to the
         // code for setByteCodeOperandsFormat2, I've left it
@@ -95,23 +105,27 @@
 
         // Index bytes
         setRewrite2Bytes(local, rewriteIndex, newRewrite);
-        rewriteIndex +=2;
+        rewriteIndex += 2;
 
         byteCode.setRewrite(newRewrite);
     }
 
-
     /**
-     * This method sets the rewrite array for the bytecode
-     * using Format 2 of the JVM spec: an opcode, two index
-     * bytes, and two constant bytes. This is used for iinc.
-     * @param instruction int should be 132
-     * @param byteCode ByteCode whose rewrite array should be updated
-     * @param operandManager OperandManager source of the operands
-     * @param codeLength ignored
+     * This method sets the rewrite array for the bytecode using Format 2 of the
+     * JVM spec: an opcode, two index bytes, and two constant bytes. This is
+     * used for iinc.
+     * 
+     * @param instruction
+     *            int should be 132
+     * @param byteCode
+     *            ByteCode whose rewrite array should be updated
+     * @param operandManager
+     *            OperandManager source of the operands
+     * @param codeLength
+     *            ignored
      */
-    protected void setByteCodeOperandsFormat2(int instruction, ByteCode byteCode,
-            OperandManager operandManager, int codeLength) {
+    protected void setByteCodeOperandsFormat2(int instruction,
+            ByteCode byteCode, OperandManager operandManager, int codeLength) {
 
         final int local = operandManager.nextLocal();
         final int constWord = operandManager.nextShort();
@@ -134,11 +148,12 @@
 
         // Index bytes
         setRewrite2Bytes(local, rewriteIndex, newRewrite);
-        rewriteIndex +=2;
+        rewriteIndex += 2;
 
         // constant bytes
         setRewrite2Bytes(constWord, rewriteIndex, newRewrite);
-        rewriteIndex += 2; // not strictly necessary, but just in case something comes along later
+        rewriteIndex += 2; // not strictly necessary, but just in case
+        // something comes along later
 
         byteCode.setRewrite(newRewrite);
     }

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AbstractBandsTestCase.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AbstractBandsTestCase.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AbstractBandsTestCase.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AbstractBandsTestCase.java Fri Apr 11 03:09:38 2008
@@ -26,19 +26,20 @@
 import org.apache.harmony.pack200.SegmentOptions;
 
 /**
- *
+ * 
  */
 public abstract class AbstractBandsTestCase extends TestCase {
 
     protected int numClasses = 1;
-    protected int[] numMethods = {1};
+    protected int[] numMethods = { 1 };
 
     public class MockSegmentHeader extends SegmentHeader {
+
         public MockSegmentHeader(Segment segment) {
-			super(segment);
-		}
+            super(segment);
+        }
 
-		public int getClassCount() {
+        public int getClassCount() {
             return numClasses;
         }
 
@@ -66,8 +67,6 @@
             return null;
         }
 
-
-
     }
 
     public class MockSegment extends Segment {
@@ -80,6 +79,5 @@
             return new MockSegmentHeader(this);
         }
     }
-
 
 }

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AttributeLayoutMapTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AttributeLayoutMapTest.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AttributeLayoutMapTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AttributeLayoutMapTest.java Fri Apr 11 03:09:38 2008
@@ -23,26 +23,31 @@
 import org.apache.harmony.pack200.Pack200Exception;
 
 public class AttributeLayoutMapTest extends TestCase {
-	public void testRepeatable() throws Pack200Exception {
-		// Check we can retrieve a default layout
-		AttributeLayoutMap a = new AttributeLayoutMap();
-		AttributeLayout layout = a.getAttributeLayout("SourceFile", AttributeLayout.CONTEXT_CLASS);
-		assertNotNull(layout);
-		assertEquals("RUNH",layout.getLayout());
-		// and that we can change it
-		a.add(new AttributeLayout("SourceFile",AttributeLayout.CONTEXT_CLASS,"FROG",15));
-		layout = a.getAttributeLayout("SourceFile", AttributeLayout.CONTEXT_CLASS);
-		assertNotNull(layout);
-		assertEquals("FROG",layout.getLayout());
-		assertTrue(layout.matches(1<<15));
-		assertFalse(layout.matches(1<<16));
-		assertTrue(layout.matches(-1));
-		assertFalse(layout.matches(0));
-		// and that changes don't affect subsequent defaults
-		AttributeLayoutMap b = new AttributeLayoutMap();
-		layout = b.getAttributeLayout("SourceFile", AttributeLayout.CONTEXT_CLASS);
-		assertNotNull(layout);
-		assertEquals("RUNH",layout.getLayout());
 
-	}
+    public void testRepeatable() throws Pack200Exception {
+        // Check we can retrieve a default layout
+        AttributeLayoutMap a = new AttributeLayoutMap();
+        AttributeLayout layout = a.getAttributeLayout("SourceFile",
+                AttributeLayout.CONTEXT_CLASS);
+        assertNotNull(layout);
+        assertEquals("RUNH", layout.getLayout());
+        // and that we can change it
+        a.add(new AttributeLayout("SourceFile", AttributeLayout.CONTEXT_CLASS,
+                "FROG", 15));
+        layout = a.getAttributeLayout("SourceFile",
+                AttributeLayout.CONTEXT_CLASS);
+        assertNotNull(layout);
+        assertEquals("FROG", layout.getLayout());
+        assertTrue(layout.matches(1 << 15));
+        assertFalse(layout.matches(1 << 16));
+        assertTrue(layout.matches(-1));
+        assertFalse(layout.matches(0));
+        // and that changes don't affect subsequent defaults
+        AttributeLayoutMap b = new AttributeLayoutMap();
+        layout = b.getAttributeLayout("SourceFile",
+                AttributeLayout.CONTEXT_CLASS);
+        assertNotNull(layout);
+        assertEquals("RUNH", layout.getLayout());
+
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AttributeLayoutTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AttributeLayoutTest.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AttributeLayoutTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AttributeLayoutTest.java Fri Apr 11 03:09:38 2008
@@ -26,94 +26,108 @@
 
 public class AttributeLayoutTest extends TestCase {
 
-	public class TestSegment extends Segment {
-		public SegmentConstantPool getConstantPool() {
-			final Object[][] data = new Object[][] {
-					{ }, // ALL
-					{ "Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine" }, // UTF-8
-					{ },
-					{ },
-					{ },
-					{ },
-					{ },
-					{ },
-					{ "Eins", "Zwei", "Drei", "Vier", "Funf", "Sechs", "Sieben", "Acht", "Neun" }, // Signature
-			};
-			return new SegmentConstantPool(null) {
-				public Object getValue(int cp, long index) {
-					if (index == -1)
-						return null;
-					return data[cp][(int)index];
-				}
-
-			};
-		}
-	}
-
-	public void testBadData() {
-		assertTrue(throwsException(null,AttributeLayout.CONTEXT_CLASS,""));
-		assertTrue(throwsException("",AttributeLayout.CONTEXT_CLASS,""));
-		assertTrue(!throwsException("name",AttributeLayout.CONTEXT_CLASS,""));
-		assertTrue(!throwsException("name",AttributeLayout.CONTEXT_METHOD,""));
-		assertTrue(!throwsException("name",AttributeLayout.CONTEXT_FIELD,""));
-		assertTrue(!throwsException("name",AttributeLayout.CONTEXT_CODE,""));
-		assertTrue(throwsException("name",-1,""));
-		assertTrue(throwsException("name",1234,""));
-	}
-
-	public void testLayoutRU() throws Pack200Exception {
-		AttributeLayout layout = new AttributeLayout("RU",AttributeLayout.CONTEXT_CLASS,"RU", 1);
-		Segment segment = new TestSegment();
-		assertNull(layout.getValue(-1, segment.getConstantPool()));
-		assertEquals("Zero",layout.getValue(0, segment.getConstantPool()));
-		assertEquals("One",layout.getValue(1, segment.getConstantPool()));
-	}
-
-	public void testLayoutRUN() throws Pack200Exception {
-		AttributeLayout layout = new AttributeLayout("RUN",AttributeLayout.CONTEXT_CLASS,"RUN", 1);
-		Segment segment = new TestSegment();
-		assertNull(layout.getValue(0, segment.getConstantPool()));
-		assertEquals("Zero",layout.getValue(1, segment.getConstantPool()));
-		assertEquals("One",layout.getValue(2, segment.getConstantPool()));
-	}
-
-	public void testLayoutRS() throws Pack200Exception {
-		AttributeLayout layout = new AttributeLayout("RS",AttributeLayout.CONTEXT_CLASS,"RS", 1);
-		Segment segment = new TestSegment();
-		assertNull(layout.getValue(-1, segment.getConstantPool()));
-		assertEquals("Eins",layout.getValue(0, segment.getConstantPool()));
-		assertEquals("Zwei",layout.getValue(1, segment.getConstantPool()));
-	}
+    public class TestSegment extends Segment {
+
+        public SegmentConstantPool getConstantPool() {
+            final Object[][] data = new Object[][] {
+                    {}, // ALL
+                    { "Zero", "One", "Two", "Three", "Four", "Five", "Six",
+                            "Seven", "Eight", "Nine" }, // UTF-8
+                    {},
+                    {},
+                    {},
+                    {},
+                    {},
+                    {},
+                    { "Eins", "Zwei", "Drei", "Vier", "Funf", "Sechs",
+                            "Sieben", "Acht", "Neun" }, // Signature
+            };
+            return new SegmentConstantPool(null) {
+
+                public Object getValue(int cp, long index) {
+                    if (index == -1)
+                        return null;
+                    return data[cp][(int) index];
+                }
+
+            };
+        }
+    }
+
+    public void testBadData() {
+        assertTrue(throwsException(null, AttributeLayout.CONTEXT_CLASS, ""));
+        assertTrue(throwsException("", AttributeLayout.CONTEXT_CLASS, ""));
+        assertTrue(!throwsException("name", AttributeLayout.CONTEXT_CLASS, ""));
+        assertTrue(!throwsException("name", AttributeLayout.CONTEXT_METHOD, ""));
+        assertTrue(!throwsException("name", AttributeLayout.CONTEXT_FIELD, ""));
+        assertTrue(!throwsException("name", AttributeLayout.CONTEXT_CODE, ""));
+        assertTrue(throwsException("name", -1, ""));
+        assertTrue(throwsException("name", 1234, ""));
+    }
+
+    public void testLayoutRU() throws Pack200Exception {
+        AttributeLayout layout = new AttributeLayout("RU",
+                AttributeLayout.CONTEXT_CLASS, "RU", 1);
+        Segment segment = new TestSegment();
+        assertNull(layout.getValue(-1, segment.getConstantPool()));
+        assertEquals("Zero", layout.getValue(0, segment.getConstantPool()));
+        assertEquals("One", layout.getValue(1, segment.getConstantPool()));
+    }
+
+    public void testLayoutRUN() throws Pack200Exception {
+        AttributeLayout layout = new AttributeLayout("RUN",
+                AttributeLayout.CONTEXT_CLASS, "RUN", 1);
+        Segment segment = new TestSegment();
+        assertNull(layout.getValue(0, segment.getConstantPool()));
+        assertEquals("Zero", layout.getValue(1, segment.getConstantPool()));
+        assertEquals("One", layout.getValue(2, segment.getConstantPool()));
+    }
+
+    public void testLayoutRS() throws Pack200Exception {
+        AttributeLayout layout = new AttributeLayout("RS",
+                AttributeLayout.CONTEXT_CLASS, "RS", 1);
+        Segment segment = new TestSegment();
+        assertNull(layout.getValue(-1, segment.getConstantPool()));
+        assertEquals("Eins", layout.getValue(0, segment.getConstantPool()));
+        assertEquals("Zwei", layout.getValue(1, segment.getConstantPool()));
+    }
 
     public void testLayoutRSN() throws Pack200Exception {
-		AttributeLayout layout = new AttributeLayout("RSN",AttributeLayout.CONTEXT_CLASS,"RSN", 1);
-		Segment segment = new TestSegment();
-		assertNull(layout.getValue(0, segment.getConstantPool()));
-		assertEquals("Eins",layout.getValue(1, segment.getConstantPool()));
-		assertEquals("Zwei",layout.getValue(2, segment.getConstantPool()));
-	}
+        AttributeLayout layout = new AttributeLayout("RSN",
+                AttributeLayout.CONTEXT_CLASS, "RSN", 1);
+        Segment segment = new TestSegment();
+        assertNull(layout.getValue(0, segment.getConstantPool()));
+        assertEquals("Eins", layout.getValue(1, segment.getConstantPool()));
+        assertEquals("Zwei", layout.getValue(2, segment.getConstantPool()));
+    }
 
     public void testGetCodec() throws Pack200Exception {
-        AttributeLayout layout = new AttributeLayout("O", AttributeLayout.CONTEXT_CLASS, "HOBS", 1);
+        AttributeLayout layout = new AttributeLayout("O",
+                AttributeLayout.CONTEXT_CLASS, "HOBS", 1);
         assertEquals(Codec.BRANCH5, layout.getCodec());
-        layout = new AttributeLayout("P", AttributeLayout.CONTEXT_METHOD, "PIN", 1);
+        layout = new AttributeLayout("P", AttributeLayout.CONTEXT_METHOD,
+                "PIN", 1);
         assertEquals(Codec.BCI5, layout.getCodec());
-        layout = new AttributeLayout("S", AttributeLayout.CONTEXT_FIELD, "HS", 1);
+        layout = new AttributeLayout("S", AttributeLayout.CONTEXT_FIELD, "HS",
+                1);
         assertEquals(Codec.SIGNED5, layout.getCodec());
-        layout = new AttributeLayout("RS", AttributeLayout.CONTEXT_CODE, "RRRS", 1);
+        layout = new AttributeLayout("RS", AttributeLayout.CONTEXT_CODE,
+                "RRRS", 1);
         assertEquals(Codec.UNSIGNED5, layout.getCodec());
-        layout = new AttributeLayout("KS", AttributeLayout.CONTEXT_CLASS, "RKS", 1);
+        layout = new AttributeLayout("KS", AttributeLayout.CONTEXT_CLASS,
+                "RKS", 1);
         assertEquals(Codec.UNSIGNED5, layout.getCodec());
-        layout = new AttributeLayout("B", AttributeLayout.CONTEXT_CLASS, "TRKSB", 1);
+        layout = new AttributeLayout("B", AttributeLayout.CONTEXT_CLASS,
+                "TRKSB", 1);
         assertEquals(Codec.BYTE1, layout.getCodec());
     }
 
-	public boolean throwsException(String name, int context, String layout) {
-		try {
-			new AttributeLayout(name,context,layout,-1);
-			return false;
-		} catch (Pack200Exception e) {
-			return true;
-		}
-	}
+    public boolean throwsException(String name, int context, String layout) {
+        try {
+            new AttributeLayout(name, context, layout, -1);
+            return false;
+        } catch (Pack200Exception e) {
+            return true;
+        }
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BHSDCodecTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BHSDCodecTest.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BHSDCodecTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BHSDCodecTest.java Fri Apr 11 03:09:38 2008
@@ -31,14 +31,14 @@
  */
 public class BHSDCodecTest extends TestCase {
 
-
     public void testEncodeDecode() throws IOException, Pack200Exception {
         for (int i = 1; i < 116; i++) {
 
             BHSDCodec codec = (BHSDCodec) CodecEncoding.getCodec(i, null, null);
 
-            if(!codec.isDelta()) {
-                // Test encode-decode with a selection of numbers within the range of the codec
+            if (!codec.isDelta()) {
+                // Test encode-decode with a selection of numbers within the
+                // range of the codec
                 long largest = codec.largest();
                 long smallest = codec.isSigned() ? codec.smallest() : 0;
                 long difference = (largest - smallest) / 4;
@@ -46,14 +46,14 @@
                     byte[] encoded = codec.encode(j, 0);
                     long decoded = 0;
                     try {
-                        decoded = codec.decode(new ByteArrayInputStream(encoded),
-                                0);
+                        decoded = codec.decode(
+                                new ByteArrayInputStream(encoded), 0);
                     } catch (EOFException e) {
                         System.out.println(e);
                     }
                     if (j != decoded) {
-                        fail("Failed with codec: " + i + ", " + codec + " expected: " + j
-                                + ", got: " + decoded);
+                        fail("Failed with codec: " + i + ", " + codec
+                                + " expected: " + j + ", got: " + decoded);
                     }
                 }
             }

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BandSetTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BandSetTest.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BandSetTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BandSetTest.java Fri Apr 11 03:09:38 2008
@@ -32,6 +32,7 @@
 public class BandSetTest extends TestCase {
 
     public class MockSegment extends Segment {
+
         public SegmentHeader getSegmentHeader() {
             return new SegmentHeader(this);
         }
@@ -39,14 +40,15 @@
 
     private final BandSet bandSet = new BandSet(new MockSegment()) {
 
-        public void unpack(InputStream inputStream) throws IOException, Pack200Exception {
+        public void unpack(InputStream inputStream) throws IOException,
+                Pack200Exception {
         }
 
     };
 
     public void testDecodeBandInt() throws IOException, Pack200Exception {
         BHSDCodec codec = Codec.BYTE1;
-        byte[] bytes = new byte[]{(byte)3,(byte)56,(byte)122,(byte)78};
+        byte[] bytes = new byte[] { (byte) 3, (byte) 56, (byte) 122, (byte) 78 };
         InputStream in = new ByteArrayInputStream(bytes);
         int[] ints = bandSet.decodeBandInt("Test Band", in, codec, 4);
         for (int i = 0; i < ints.length; i++) {
@@ -56,19 +58,24 @@
 
     public void testDecodeBandLong() throws IOException, Pack200Exception {
         BHSDCodec codec = Codec.BYTE1;
-        byte[] bytes = new byte[]{(byte)3,(byte)56,(byte)122,(byte)78, (byte)0, (byte)255};
+        byte[] bytes = new byte[] { (byte) 3, (byte) 56, (byte) 122, (byte) 78,
+                (byte) 0, (byte) 255 };
         InputStream in = new ByteArrayInputStream(bytes);
         long[] longs = bandSet.decodeBandLong("Test Band", in, codec, 6);
         for (int i = 0; i < longs.length; i++) {
-            assertEquals("Wrong value in position " + i, (byte)longs[i], bytes[i]);
+            assertEquals("Wrong value in position " + i, (byte) longs[i],
+                    bytes[i]);
         }
-        //TODO: Should test this with other Codecs.
+        // TODO: Should test this with other Codecs.
     }
 
     public void testDecodeBandLong2() throws IOException, Pack200Exception {
 
         BHSDCodec codec = Codec.DELTA5;
-        byte[] bytes = new byte[]{3, 1, 2, 3, 4, 5}; // 3 is decoded to -2 by DELTA5, which signifies a switch to BYTE1
+        byte[] bytes = new byte[] { 3, 1, 2, 3, 4, 5 }; // 3 is decoded to -2 by
+        // DELTA5, which
+        // signifies a switch to
+        // BYTE1
         InputStream in = new ByteArrayInputStream(bytes);
         long[] longs = bandSet.decodeBandLong("Test Band", in, codec, 5);
         for (int i = 0; i < longs.length; i++) {

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BcBandsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BcBandsTest.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BcBandsTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BcBandsTest.java Fri Apr 11 03:09:38 2008
@@ -41,31 +41,31 @@
  */
 public class BcBandsTest extends AbstractBandsTestCase {
 
-	public class MockCpBands extends CpBands {
+    public class MockCpBands extends CpBands {
 
-		public MockCpBands(Segment segment) {
-			super(segment);
-		}
-
-	    public String[] getCpString() {
-        	String[] classes = new String[100];
-        	for(int index=0; index < 100; index++) {
-        		classes[index] = "java/lang/Stri:ng(J)";
-        	}
-        	return classes;
-	    }
-
-	    public String[] getCpClass() {
-	    	return getCpString();
-	    }
-
-	    public String[] getCpFieldClass() {
-	    	return getCpClass();
-	    }
-
-	    public String[] getCpFieldDescriptor() {
-	    	return getCpString();
-	    }
+        public MockCpBands(Segment segment) {
+            super(segment);
+        }
+
+        public String[] getCpString() {
+            String[] classes = new String[100];
+            for (int index = 0; index < 100; index++) {
+                classes[index] = "java/lang/Stri:ng(J)";
+            }
+            return classes;
+        }
+
+        public String[] getCpClass() {
+            return getCpString();
+        }
+
+        public String[] getCpFieldClass() {
+            return getCpClass();
+        }
+
+        public String[] getCpFieldDescriptor() {
+            return getCpString();
+        }
 
         public String[] getCpMethodClass() {
             return getCpClass();
@@ -83,46 +83,47 @@
             return getCpString();
         }
 
-	    public int[] getCpInt() {
-        	int[] elements = new int[100];
-        	for(int index=0; index < 100; index++) {
-        		elements[index] = 1;
-        	}
-        	return elements;
-	    }
-
-	    public float[] getCpFloat() {
-        	float[] elements = new float[100];
-        	for(int index=0; index < 100; index++) {
-        		elements[index] = 1.0f;
-        	}
-        	return elements;
-	    }
-
-	    public long[] getCpLong() {
-	    	long[] elements = new long[100];
-	    	for(int index=0; index < 100; index++) {
-	    		elements[index] = 1L;
-	    	}
-	    	return elements;
-	    }
-
-	    public double[] getCpDouble() {
-	    	double[] elements = new double[100];
-	    	for(int index=0; index < 100; index++) {
-	    		elements[index] = 1.0D;
-	    	}
-	    	return elements;
-	    }
-}
+        public int[] getCpInt() {
+            int[] elements = new int[100];
+            for (int index = 0; index < 100; index++) {
+                elements[index] = 1;
+            }
+            return elements;
+        }
+
+        public float[] getCpFloat() {
+            float[] elements = new float[100];
+            for (int index = 0; index < 100; index++) {
+                elements[index] = 1.0f;
+            }
+            return elements;
+        }
+
+        public long[] getCpLong() {
+            long[] elements = new long[100];
+            for (int index = 0; index < 100; index++) {
+                elements[index] = 1L;
+            }
+            return elements;
+        }
+
+        public double[] getCpDouble() {
+            double[] elements = new double[100];
+            for (int index = 0; index < 100; index++) {
+                elements[index] = 1.0D;
+            }
+            return elements;
+        }
+    }
 
     public class MockClassBands extends ClassBands {
+
         public MockClassBands(Segment segment) {
             super(segment);
         }
 
         public long[][] getMethodFlags() {
-            long[][] flags = new long[numClasses][] ;
+            long[][] flags = new long[numClasses][];
             for (int i = 0; i < flags.length; i++) {
                 flags[i] = new long[numMethods[i]];
             }
@@ -146,7 +147,7 @@
         }
 
         public String[][] getMethodDescr() {
-            String[][] descr =  new String[numClasses][];
+            String[][] descr = new String[numClasses][];
             for (int i = 0; i < descr.length; i++) {
                 descr[i] = new String[numMethods[i]];
                 for (int j = 0; j < descr[i].length; j++) {
@@ -157,23 +158,23 @@
         }
 
         public String[] getClassThis() {
-        	String[] thisClasses = new String[numClasses];
-        	for(int index=0; index < numClasses; index++) {
-        		thisClasses[index] = "java/lang/String";
-        	}
-        	return thisClasses;
+            String[] thisClasses = new String[numClasses];
+            for (int index = 0; index < numClasses; index++) {
+                thisClasses[index] = "java/lang/String";
+            }
+            return thisClasses;
         }
 
         public String[] getClassSuper() {
-        	String[] superClasses = new String[numClasses];
-        	for(int index=0; index < numClasses; index++) {
-        		superClasses[index] = "java/lang/Object";
-        	}
-        	return superClasses;
+            String[] superClasses = new String[numClasses];
+            for (int index = 0; index < numClasses; index++) {
+                superClasses[index] = "java/lang/Object";
+            }
+            return superClasses;
         }
 
         public ArrayList[][] getMethodAttributes() {
-            ArrayList[][] attributes =  new ArrayList[numClasses][];
+            ArrayList[][] attributes = new ArrayList[numClasses][];
             for (int i = 0; i < attributes.length; i++) {
                 attributes[i] = new ArrayList[numMethods[i]];
                 for (int j = 0; j < attributes[i].length; j++) {
@@ -185,11 +186,11 @@
 
         public ArrayList getOrderedCodeAttributes() {
             int totalMethods = 0;
-            for(int classIndex = 0; classIndex < numMethods.length; classIndex++) {
+            for (int classIndex = 0; classIndex < numMethods.length; classIndex++) {
                 totalMethods = totalMethods + numMethods[classIndex];
             }
             ArrayList orderedAttributeList = new ArrayList();
-            for(int classIndex=0; classIndex < totalMethods; classIndex++) {
+            for (int classIndex = 0; classIndex < totalMethods; classIndex++) {
                 ArrayList currentAttributes = new ArrayList();
                 orderedAttributeList.add(currentAttributes);
             }
@@ -198,15 +199,17 @@
     }
 
     public class MockSegment extends AbstractBandsTestCase.MockSegment {
-    	public CpBands cpBands;
+
+        public CpBands cpBands;
+
         protected AttrDefinitionBands getAttrDefinitionBands() {
             return new MockAttributeDefinitionBands(this);
         }
 
         protected CpBands getCpBands() {
-        	if(null == cpBands) {
-        		cpBands = new MockCpBands(this);
-        	}
+            if (null == cpBands) {
+                cpBands = new MockCpBands(this);
+            }
             return cpBands;
         }
 
@@ -224,7 +227,7 @@
     /**
      * Test with single byte instructions that mean all other bands apart from
      * bc_codes will be empty.
-     *
+     * 
      * @throws IOException
      * @throws Pack200Exception
      */
@@ -246,57 +249,64 @@
                 (byte) 194, (byte) 195, (byte) 255 };
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
-        assertEquals(bytes.length - 1, bcBands.getMethodByteCodePacked()[0][0].length);
+        assertEquals(bytes.length - 1,
+                bcBands.getMethodByteCodePacked()[0][0].length);
     }
 
     /**
      * Test with multiple classes but single byte instructions
-     *
+     * 
      * @throws IOException
      * @throws Pack200Exception
      */
-    public void testMultipleClassesSimple() throws IOException, Pack200Exception {
+    public void testMultipleClassesSimple() throws IOException,
+            Pack200Exception {
         numClasses = 2;
-        numMethods = new int[] {1,1};
-        byte[] bytes = new byte[] {50, 50, (byte)255, 50, 50, (byte)255};
+        numMethods = new int[] { 1, 1 };
+        byte[] bytes = new byte[] { 50, 50, (byte) 255, 50, 50, (byte) 255 };
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(2, bcBands.getMethodByteCodePacked()[0][0].length);
         assertEquals(2, bcBands.getMethodByteCodePacked()[0][0].length);
 
         numClasses = 1;
-        numMethods = new int[] {1};
+        numMethods = new int[] { 1 };
     }
 
     /**
-     * Test with multiple classes and multiple methods but single byte instructions
+     * Test with multiple classes and multiple methods but single byte
+     * instructions
+     * 
      * @throws IOException
      * @throws Pack200Exception
      */
-    public void testMultipleMethodsSimple() throws IOException, Pack200Exception {
+    public void testMultipleMethodsSimple() throws IOException,
+            Pack200Exception {
         numClasses = 2;
-        numMethods = new int[] {3,1};
-        byte[] bytes = new byte[] {50, 50, (byte)255,50, 50, (byte)255, 50, 50, (byte)255, 50, 50, (byte)255};
+        numMethods = new int[] { 3, 1 };
+        byte[] bytes = new byte[] { 50, 50, (byte) 255, 50, 50, (byte) 255, 50,
+                50, (byte) 255, 50, 50, (byte) 255 };
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(2, bcBands.getMethodByteCodePacked()[0][0].length);
         assertEquals(2, bcBands.getMethodByteCodePacked()[0][0].length);
 
         numClasses = 1;
-        numMethods = new int[] {1};
+        numMethods = new int[] { 1 };
     }
 
-
     /**
-     * Test with codes that require entries in the bc_case_count and bc_case_value bands
+     * Test with codes that require entries in the bc_case_count and
+     * bc_case_value bands
+     * 
      * @throws Pack200Exception
      * @throws IOException
      */
     public void testBcCaseBands() throws IOException, Pack200Exception {
-        byte[] bytes = new byte[] { (byte)170, (byte)171, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (byte)255,
-                2, 5, // bc_case_count
+        byte[] bytes = new byte[] { (byte) 170, (byte) 171, 0, 0, 0, 0, 0, 0,
+                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (byte) 255, 2, 5, // bc_case_count
                 0, 0, 0, 0, 0, 0, 0, // bc_case_value
-                0, 0, 0, 0, 0, 0, 0, 0, 0}; // bc_label
+                0, 0, 0, 0, 0, 0, 0, 0, 0 }; // bc_label
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(18, bcBands.getMethodByteCodePacked()[0][0].length);
@@ -312,15 +322,15 @@
 
     /**
      * Test with codes that should require entries in the bc_byte band
-     *
+     * 
      * @throws Pack200Exception
      * @throws IOException
      */
     public void testBcByteBand() throws IOException, Pack200Exception {
-        byte[] bytes = new byte[] {16, (byte)132, (byte)188, (byte)197, (byte)255,
-                8, 8, 8, 8, // bc_byte band
+        byte[] bytes = new byte[] { 16, (byte) 132, (byte) 188, (byte) 197,
+                (byte) 255, 8, 8, 8, 8, // bc_byte band
                 8, // bc_locals band (required by iinc (132))
-                8}; // bc_class band (required by multianewarray (197))
+                8 }; // bc_class band (required by multianewarray (197))
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(4, bcBands.getMethodByteCodePacked()[0][0].length);
@@ -335,15 +345,15 @@
 
     /**
      * Test with codes that should require entries in the bc_short band
-     *
+     * 
      * @throws Pack200Exception
      * @throws IOException
      */
     public void testBcShortBand() throws IOException, Pack200Exception {
-    	//TODO: Need to fix this testcase so it has enough data to pass.
-        byte[] bytes = new byte[] {17, (byte)196, (byte)132, (byte)255,
-                8, 8,// bc_short band
-                8}; // bc_locals band (required by wide iinc (196, 132))
+        // TODO: Need to fix this testcase so it has enough data to pass.
+        byte[] bytes = new byte[] { 17, (byte) 196, (byte) 132, (byte) 255, 8,
+                8,// bc_short band
+                8 }; // bc_locals band (required by wide iinc (196, 132))
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(3, bcBands.getMethodByteCodePacked()[0][0].length);
@@ -353,14 +363,14 @@
 
     /**
      * Test with codes that should require entries in the bc_local band
-     *
+     * 
      * @throws Pack200Exception
      * @throws IOException
      */
     public void testBcLocalBand() throws IOException, Pack200Exception {
-        byte[] bytes = new byte[] {21, 22, 23, 24, 25,
-                54, 55, 56, 57, 58, (byte)169, (byte) 255,
-                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}; // bc_local band
+        byte[] bytes = new byte[] { 21, 22, 23, 24, 25, 54, 55, 56, 57, 58,
+                (byte) 169, (byte) 255, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 }; // bc_local
+        // band
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(11, bcBands.getMethodByteCodePacked()[0][0].length);
@@ -369,19 +379,29 @@
 
     /**
      * Test with codes that should require entries in the bc_label band
-     *
+     * 
      * @throws Pack200Exception
      * @throws IOException
      */
     public void testBcLabelBand() throws IOException, Pack200Exception {
-        byte[] bytes = new byte[] {(byte) 159, (byte) 160, (byte) 161,
+        byte[] bytes = new byte[] { (byte) 159, (byte) 160, (byte) 161,
                 (byte) 162, (byte) 163, (byte) 164, (byte) 165, (byte) 166,
-                (byte) 167, (byte) 168,  (byte) 170, (byte) 171,  (byte) 198, (byte) 199, (byte) 200, (byte) 201, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (byte) 255,
-                2, 2, // bc_case_count (required by tableswitch (170) and lookupswitch (171))
+                (byte) 167, (byte) 168, (byte) 170, (byte) 171, (byte) 198,
+                (byte) 199, (byte) 200, (byte) 201, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (byte) 255, 2, 2, // bc_case_count
+                // (required
+                // by
+                // tableswitch
+                // (170) and
+                // lookupswitch
+                // (171))
                 0, 0, 0, 0, // bc_case_value
-//                Now that we're actually doing real label lookup, need valid labels
-//                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 }; // bc_label band
-                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // bc_label band
+                // Now that we're actually doing real label lookup, need valid
+                // labels
+                // 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 }; // bc_label
+                // band
+                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // bc_label
+        // band
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(36, bcBands.getMethodByteCodePacked()[0][0].length);
@@ -389,11 +409,10 @@
     }
 
     public void testWideForms() throws IOException, Pack200Exception {
-        byte[] bytes = new byte[] {(byte) 196, (byte) 54, // wide istore
+        byte[] bytes = new byte[] { (byte) 196, (byte) 54, // wide istore
                 (byte) 196, (byte) 132, // wide iinc
-                (byte) 255,
-                0, // bc_short band
-                0, 1}; // bc_locals band
+                (byte) 255, 0, // bc_short band
+                0, 1 }; // bc_locals band
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(4, bcBands.getMethodByteCodePacked()[0][0].length);
@@ -403,13 +422,13 @@
 
     /**
      * Test with codes that should require entries in the bc_intref band
-     *
+     * 
      * @throws Pack200Exception
      * @throws IOException
      */
     public void testBcIntRefBand() throws IOException, Pack200Exception {
-        byte[] bytes = new byte[] {(byte)234, (byte)237, (byte)255,
-                8, 8}; // bc_intref band
+        byte[] bytes = new byte[] { (byte) 234, (byte) 237, (byte) 255, 8, 8 }; // bc_intref
+        // band
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(2, bcBands.getMethodByteCodePacked()[0][0].length);
@@ -419,13 +438,13 @@
 
     /**
      * Test with codes that should require entries in the bc_floatref band
-     *
+     * 
      * @throws Pack200Exception
      * @throws IOException
      */
     public void testBcFloatRefBand() throws IOException, Pack200Exception {
-        byte[] bytes = new byte[] {(byte)235, (byte)238, (byte)255,
-                8, 8}; // bc_floatref band
+        byte[] bytes = new byte[] { (byte) 235, (byte) 238, (byte) 255, 8, 8 }; // bc_floatref
+        // band
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(2, bcBands.getMethodByteCodePacked()[0][0].length);
@@ -435,13 +454,12 @@
 
     /**
      * Test with codes that should require entries in the bc_longref band
-     *
+     * 
      * @throws Pack200Exception
      * @throws IOException
      */
     public void testBcLongRefBand() throws IOException, Pack200Exception {
-        byte[] bytes = new byte[] {20, (byte)255,
-                8}; // bc_longref band
+        byte[] bytes = new byte[] { 20, (byte) 255, 8 }; // bc_longref band
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(1, bcBands.getMethodByteCodePacked()[0][0].length);
@@ -451,13 +469,13 @@
 
     /**
      * Test with codes that should require entries in the bc_doubleref band
-     *
+     * 
      * @throws Pack200Exception
      * @throws IOException
      */
     public void testBcDoubleRefBand() throws IOException, Pack200Exception {
-        byte[] bytes = new byte[] {(byte)239, (byte)255,
-                8}; // bc_doubleref band
+        byte[] bytes = new byte[] { (byte) 239, (byte) 255, 8 }; // bc_doubleref
+        // band
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(1, bcBands.getMethodByteCodePacked()[0][0].length);
@@ -465,16 +483,15 @@
         assertEquals(1, bc_doubleref.length);
     }
 
-
     /**
      * Test with codes that should require entries in the bc_stringref band
-     *
+     * 
      * @throws Pack200Exception
      * @throws IOException
      */
     public void testBcStringRefBand() throws IOException, Pack200Exception {
-        byte[] bytes = new byte[] {18, 19, (byte)255,
-                8, 8}; // bc_stringref band
+        byte[] bytes = new byte[] { 18, 19, (byte) 255, 8, 8 }; // bc_stringref
+        // band
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(2, bcBands.getMethodByteCodePacked()[0][0].length);
@@ -482,16 +499,15 @@
         assertEquals(2, bc_stringref.length);
     }
 
-
     /**
      * Test with codes that should require entries in the bc_classref band
-     *
+     * 
      * @throws Pack200Exception
      * @throws IOException
      */
     public void testBcClassRefBand() throws IOException, Pack200Exception {
-        byte[] bytes = new byte[] {(byte)233, (byte)236, (byte)255,
-                8, 8}; // bc_classref band
+        byte[] bytes = new byte[] { (byte) 233, (byte) 236, (byte) 255, 8, 8 }; // bc_classref
+        // band
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(2, bcBands.getMethodByteCodePacked()[0][0].length);
@@ -501,13 +517,13 @@
 
     /**
      * Test with codes that should require entries in the bc_fieldref band
-     *
+     * 
      * @throws Pack200Exception
      * @throws IOException
      */
     public void testBcFieldRefBand() throws IOException, Pack200Exception {
-        byte[] bytes = new byte[] {(byte)178, (byte)179, (byte)180, (byte)181, (byte)255,
-                8, 8, 8, 8}; // bc_fieldref band
+        byte[] bytes = new byte[] { (byte) 178, (byte) 179, (byte) 180,
+                (byte) 181, (byte) 255, 8, 8, 8, 8 }; // bc_fieldref band
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(4, bcBands.getMethodByteCodePacked()[0][0].length);
@@ -517,13 +533,13 @@
 
     /**
      * Test with codes that should require entries in the bc_methodref band
-     *
+     * 
      * @throws Pack200Exception
      * @throws IOException
      */
     public void testBcMethodRefBand() throws IOException, Pack200Exception {
-        byte[] bytes = new byte[] {(byte)182, (byte)183, (byte)184, (byte)255,
-                8, 8, 8}; // bc_methodref band
+        byte[] bytes = new byte[] { (byte) 182, (byte) 183, (byte) 184,
+                (byte) 255, 8, 8, 8 }; // bc_methodref band
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(3, bcBands.getMethodByteCodePacked()[0][0].length);
@@ -533,13 +549,13 @@
 
     /**
      * Test with codes that should require entries in the bc_imethodref band
-     *
+     * 
      * @throws Pack200Exception
      * @throws IOException
      */
     public void testBcIMethodRefBand() throws IOException, Pack200Exception {
-        byte[] bytes = new byte[] {(byte)185, (byte)255,
-                8}; // bc_imethodref band
+        byte[] bytes = new byte[] { (byte) 185, (byte) 255, 8 }; // bc_imethodref
+        // band
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(1, bcBands.getMethodByteCodePacked()[0][0].length);
@@ -549,15 +565,14 @@
 
     /**
      * Test with codes that should require entries in the bc_thisfieldref band
-     *
+     * 
      * @throws Pack200Exception
      * @throws IOException
      */
     public void testBcThisFieldBand() throws IOException, Pack200Exception {
         byte[] bytes = new byte[] { (byte) 202, (byte) 203, (byte) 204,
                 (byte) 205, (byte) 209, (byte) 210, (byte) 211, (byte) 212,
-                (byte) 255,
-                8, 8, 8, 8, 8, 8, 8, 8 }; // bc_thisfieldref band
+                (byte) 255, 8, 8, 8, 8, 8, 8, 8, 8 }; // bc_thisfieldref band
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(8, bcBands.getMethodByteCodePacked()[0][0].length);
@@ -567,15 +582,14 @@
 
     /**
      * Test with codes that should require entries in the bc_superfield band
-     *
+     * 
      * @throws Pack200Exception
      * @throws IOException
      */
     public void testBcSuperFieldBand() throws IOException, Pack200Exception {
         byte[] bytes = new byte[] { (byte) 216, (byte) 217, (byte) 218,
                 (byte) 219, (byte) 223, (byte) 224, (byte) 225, (byte) 226,
-                (byte) 255,
-                8, 8, 8, 8, 8, 8, 8, 8}; // bc_superfield band
+                (byte) 255, 8, 8, 8, 8, 8, 8, 8, 8 }; // bc_superfield band
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(8, bcBands.getMethodByteCodePacked()[0][0].length);
@@ -585,13 +599,14 @@
 
     /**
      * Test with codes that should require entries in the bc_thismethod band
-     *
+     * 
      * @throws Pack200Exception
      * @throws IOException
      */
     public void testBcThisMethodBand() throws IOException, Pack200Exception {
-        byte[] bytes = new byte[] {(byte)206, (byte)207, (byte)208, (byte)213, (byte)214, (byte)215, (byte)255,
-                8, 8, 8, 8, 8, 8}; // bc_thismethod band
+        byte[] bytes = new byte[] { (byte) 206, (byte) 207, (byte) 208,
+                (byte) 213, (byte) 214, (byte) 215, (byte) 255, 8, 8, 8, 8, 8,
+                8 }; // bc_thismethod band
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(6, bcBands.getMethodByteCodePacked()[0][0].length);
@@ -601,15 +616,17 @@
 
     /**
      * Test with codes that should require entries in the bc_supermethod band
-     *
+     * 
      * @throws Pack200Exception
      * @throws IOException
      */
     public void testBcSuperMethodBand() throws IOException, Pack200Exception {
-    	//TODO: Need to fix this testcase so it has enough data to pass.
-    	if(true) return;
-        byte[] bytes = new byte[] {(byte)220, (byte)221, (byte)222, (byte)227, (byte)228, (byte)229, (byte)255,
-                8, 8, 8, 8, 8, 8}; // bc_supermethod band
+        // TODO: Need to fix this testcase so it has enough data to pass.
+        if (true)
+            return;
+        byte[] bytes = new byte[] { (byte) 220, (byte) 221, (byte) 222,
+                (byte) 227, (byte) 228, (byte) 229, (byte) 255, 8, 8, 8, 8, 8,
+                8 }; // bc_supermethod band
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(6, bcBands.getMethodByteCodePacked()[0][0].length);
@@ -619,15 +636,16 @@
 
     /**
      * Test with codes that should require entries in the bc_initrefref band
-     *
+     * 
      * @throws Pack200Exception
      * @throws IOException
      */
     public void testBcInitRefRefBand() throws IOException, Pack200Exception {
-    	//TODO: Need to fix this testcase so it has enough data to pass.
-    	if(true) return;
-       byte[] bytes = new byte[] {(byte)230, (byte)231, (byte)232, (byte)255,
-                8, 8, 8}; // bc_initrefref band
+        // TODO: Need to fix this testcase so it has enough data to pass.
+        if (true)
+            return;
+        byte[] bytes = new byte[] { (byte) 230, (byte) 231, (byte) 232,
+                (byte) 255, 8, 8, 8 }; // bc_initrefref band
         InputStream in = new ByteArrayInputStream(bytes);
         bcBands.unpack(in);
         assertEquals(3, bcBands.getMethodByteCodePacked()[0][0].length);

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CPUTF8Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CPUTF8Test.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CPUTF8Test.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CPUTF8Test.java Fri Apr 11 03:09:38 2008
@@ -24,9 +24,12 @@
 public class CPUTF8Test extends TestCase {
 
     public void testEquality() {
-        CPUTF8 one = new CPUTF8("(III)V", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ);
-        CPUTF8 two = new CPUTF8("((I[II)V", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ);
-        CPUTF8 three = new CPUTF8("([III)V", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ);
+        CPUTF8 one = new CPUTF8("(III)V",
+                ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ);
+        CPUTF8 two = new CPUTF8("((I[II)V",
+                ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ);
+        CPUTF8 three = new CPUTF8("([III)V",
+                ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ);
         assertFalse(one.equals(two));
         assertFalse(one.equals(three));
         assertFalse(two.equals(three));

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassBandsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassBandsTest.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassBandsTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassBandsTest.java Fri Apr 11 03:09:38 2008
@@ -26,7 +26,7 @@
 import org.apache.harmony.pack200.Segment;
 
 /**
- *
+ * 
  */
 public class ClassBandsTest extends AbstractBandsTestCase {
 
@@ -74,23 +74,24 @@
     }
 
     public class MockSegment extends AbstractBandsTestCase.MockSegment {
+
         protected CpBands getCpBands() {
             return new MockCpBands(this);
         }
     }
 
-
-
     ClassBands classBands = new ClassBands(new MockSegment());
 
     public void testSimple() throws IOException, Pack200Exception {
-        cpClasses = new String[] { "Class1", "Class2", "Class3", "Interface1", "Interface2" };
+        cpClasses = new String[] { "Class1", "Class2", "Class3", "Interface1",
+                "Interface2" };
         cpDescriptor = new String[0];
         cpUTF8 = new String[0];
         byte[] classThis = Codec.DELTA5.encode(1, 0);
         byte[] classSuper = Codec.DELTA5.encode(2, 0);
         byte[] classInterfaceCount = Codec.DELTA5.encode(2, 0);
-        byte[] classInterfaceRef1 = classBands.encodeBandLong(new long[] {3, 4}, Codec.DELTA5);
+        byte[] classInterfaceRef1 = classBands.encodeBandLong(
+                new long[] { 3, 4 }, Codec.DELTA5);
         byte[] classFieldCount = Codec.DELTA5.encode(0, 0);
         byte[] classMethodCount = Codec.DELTA5.encode(0, 0);
         byte[] classFlags = Codec.UNSIGNED5.encode(0, 0);
@@ -122,15 +123,17 @@
 
     public void testWithMethods() throws Pack200Exception, IOException {
         cpClasses = new String[] { "Class1", "Class2", "Class3" };
-        cpDescriptor = new String[] {"method1", "method2", "method3"};
+        cpDescriptor = new String[] { "method1", "method2", "method3" };
         cpUTF8 = new String[0];
         byte[] classThis = Codec.DELTA5.encode(1, 0);
         byte[] classSuper = Codec.DELTA5.encode(2, 0);
         byte[] classInterfaceCount = Codec.DELTA5.encode(0, 0);
         byte[] classFieldCount = Codec.DELTA5.encode(0, 0);
         byte[] classMethodCount = Codec.DELTA5.encode(3, 0);
-        byte[] methodDescr = classBands.encodeBandLong(new long[]{0, 1, 2}, Codec.MDELTA5);
-        byte[] methodFlagsLo = classBands.encodeBandLong(new long[]{0, 0, 0}, Codec.UNSIGNED5);
+        byte[] methodDescr = classBands.encodeBandLong(new long[] { 0, 1, 2 },
+                Codec.MDELTA5);
+        byte[] methodFlagsLo = classBands.encodeBandLong(
+                new long[] { 0, 0, 0 }, Codec.UNSIGNED5);
         byte[] classFlags = Codec.UNSIGNED5.encode(0, 0);
         byte[][] allArrays = new byte[][] { classThis, classSuper,
                 classInterfaceCount, classFieldCount, classMethodCount,
@@ -164,7 +167,5 @@
     public void testWithFields() {
 
     }
-
-
 
 }

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassVersionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassVersionTest.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassVersionTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassVersionTest.java Fri Apr 11 03:09:38 2008
@@ -25,44 +25,46 @@
 import org.apache.harmony.pack200.Segment;
 
 public class ClassVersionTest extends TestCase {
-	private static final int JAVA_15 = 49;
 
-	public void testCorrectVersionOfSegment() throws IOException {
-		InputStream in = Segment.class
-				.getResourceAsStream("/org/apache/harmony/pack200/Segment.class");
-		DataInputStream din = new DataInputStream(in);
-
-		assertEquals(0xCAFEBABE, din.readInt());
-		din.readShort(); // MINOR -- don't care
-		assertTrue("Class file has been compiled with Java 1.5 compatibility"
-				+ " instead of 1.4 or lower", din.readShort() < JAVA_15);
-	}
-
-	public void testCorrectVersionOfTest() throws IOException {
-		InputStream in = Segment.class
-				.getResourceAsStream("/org/apache/harmony/pack200/tests/ClassVersionTest.class");
-		DataInputStream din = new DataInputStream(in);
-
-		assertEquals(0xCAFEBABE, din.readInt());
-		din.readShort(); // MINOR -- don't care
-		assertTrue("Class file has been compiled with Java 1.5 compatibility"
-				+ " instead of 1.4 or lower", din.readShort() < JAVA_15);
-		din.close();
-	}
-
-	public void testCorrectVersionOfAdapter() throws IOException {
-		// tests that both the file is on the classpath and that it's been
-		// compiled correctly, but without actually loading the class
-		InputStream in = Segment.class
-				.getResourceAsStream("/org/apache/harmony/pack200/Pack200Adapter.class");
-		if (in != null) { // If running in Eclipse and Java5 stuff not built/available
-			DataInputStream din = new DataInputStream(in);
-
-			assertEquals(0xCAFEBABE, din.readInt());
-			din.readShort(); // MINOR -- don't care
-			assertTrue("Class file needs 1.5 compatibility",
-					din.readShort() >= JAVA_15);
-			din.close();
-		}
-	}
+    private static final int JAVA_15 = 49;
+
+    public void testCorrectVersionOfSegment() throws IOException {
+        InputStream in = Segment.class
+                .getResourceAsStream("/org/apache/harmony/pack200/Segment.class");
+        DataInputStream din = new DataInputStream(in);
+
+        assertEquals(0xCAFEBABE, din.readInt());
+        din.readShort(); // MINOR -- don't care
+        assertTrue("Class file has been compiled with Java 1.5 compatibility"
+                + " instead of 1.4 or lower", din.readShort() < JAVA_15);
+    }
+
+    public void testCorrectVersionOfTest() throws IOException {
+        InputStream in = Segment.class
+                .getResourceAsStream("/org/apache/harmony/pack200/tests/ClassVersionTest.class");
+        DataInputStream din = new DataInputStream(in);
+
+        assertEquals(0xCAFEBABE, din.readInt());
+        din.readShort(); // MINOR -- don't care
+        assertTrue("Class file has been compiled with Java 1.5 compatibility"
+                + " instead of 1.4 or lower", din.readShort() < JAVA_15);
+        din.close();
+    }
+
+    public void testCorrectVersionOfAdapter() throws IOException {
+        // tests that both the file is on the classpath and that it's been
+        // compiled correctly, but without actually loading the class
+        InputStream in = Segment.class
+                .getResourceAsStream("/org/apache/harmony/pack200/Pack200Adapter.class");
+        if (in != null) { // If running in Eclipse and Java5 stuff not
+            // built/available
+            DataInputStream din = new DataInputStream(in);
+
+            assertEquals(0xCAFEBABE, din.readInt());
+            din.readShort(); // MINOR -- don't care
+            assertTrue("Class file needs 1.5 compatibility",
+                    din.readShort() >= JAVA_15);
+            din.close();
+        }
+    }
 }



Mime
View raw message