You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sj...@apache.org on 2008/01/29 16:54:05 UTC
svn commit: r616407 [3/4] - 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/
main/java5/org/apache/harmony...
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ClassRefForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ClassRefForm.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ClassRefForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ClassRefForm.java Tue Jan 29 07:53:23 2008
@@ -27,7 +27,7 @@
public class ClassRefForm extends ReferenceForm {
protected boolean widened = false;
-
+
public ClassRefForm(int opcode, String name, int[] rewrite) {
super(opcode, name, rewrite);
// TODO Auto-generated constructor stub
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ClassSpecificReferenceForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ClassSpecificReferenceForm.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ClassSpecificReferenceForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ClassSpecificReferenceForm.java Tue Jan 29 07:53:23 2008
@@ -36,11 +36,11 @@
super(opcode, name, rewrite);
// TODO Auto-generated constructor stub
}
-
+
protected abstract int getOffset(OperandManager operandManager);
protected abstract int getPoolID();
protected abstract String context(OperandManager operandManager);
-
+
protected void setNestedEntries(ByteCode byteCode, OperandManager operandManager, int offset) throws Pack200Exception {
SegmentConstantPool globalPool = operandManager.globalConstantPool();
ClassFileEntry[] nested = null;
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/DoubleForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/DoubleForm.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/DoubleForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/DoubleForm.java Tue Jan 29 07:53:23 2008
@@ -25,7 +25,7 @@
* double references).
*/
public class DoubleForm extends ReferenceForm {
-
+
public DoubleForm(int opcode, String name, int[] rewrite) {
super(opcode, name, rewrite);
// TODO Auto-generated constructor stub
@@ -34,7 +34,7 @@
public int getOperandType() {
return TYPE_DOUBLE;
}
-
+
public boolean hasDoubleOperand() {
return true;
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/FieldRefForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/FieldRefForm.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/FieldRefForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/FieldRefForm.java Tue Jan 29 07:53:23 2008
@@ -34,7 +34,7 @@
public int getOperandType() {
return TYPE_FIELDREF;
}
-
+
public boolean hasFieldRefOperand() {
return true;
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/IMethodRefForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/IMethodRefForm.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/IMethodRefForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/IMethodRefForm.java Tue Jan 29 07:53:23 2008
@@ -28,7 +28,7 @@
*/
public class IMethodRefForm extends ReferenceForm {
- public IMethodRefForm(int opcode, String name,
+ public IMethodRefForm(int opcode, String name,
int[] rewrite) {
super(opcode, name, rewrite);
}
@@ -48,7 +48,7 @@
protected int getPoolID() {
return SegmentConstantPool.CP_IMETHOD;
}
-
+
/* (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.Segment)
*/
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/IincForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/IincForm.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/IincForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/IincForm.java Tue Jan 29 07:53:23 2008
@@ -33,7 +33,7 @@
public int getOperandType() {
return TYPE_IINC;
}
-
+
public boolean hasIincOperand() {
return true;
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/InitMethodReferenceForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/InitMethodReferenceForm.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/InitMethodReferenceForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/InitMethodReferenceForm.java Tue Jan 29 07:53:23 2008
@@ -44,7 +44,7 @@
protected int getPoolID() {
return SegmentConstantPool.CP_METHOD;
}
-
+
protected int getOffset(OperandManager operandManager) {
return operandManager.nextInitRef();
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/IntRefForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/IntRefForm.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/IntRefForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/IntRefForm.java Tue Jan 29 07:53:23 2008
@@ -39,11 +39,11 @@
public int getOperandType() {
return TYPE_INTREF;
}
-
+
public boolean hasIntRefOperand() {
return true;
}
-
+
protected int getOffset(OperandManager operandManager) {
return operandManager.nextIntRef();
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/LabelForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/LabelForm.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/LabelForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/LabelForm.java Tue Jan 29 07:53:23 2008
@@ -28,7 +28,7 @@
public class LabelForm extends ByteCodeForm {
protected boolean widened = false;
-
+
public LabelForm(int opcode, String name, int[] rewrite) {
super(opcode, name, rewrite);
// TODO Auto-generated constructor stub
@@ -66,7 +66,7 @@
byteCode.setNestedPositions(new int[][] {{0,2}});
}
}
-
+
/* (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)
*/
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/LocalForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/LocalForm.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/LocalForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/LocalForm.java Tue Jan 29 07:53:23 2008
@@ -39,7 +39,7 @@
public int getOperandType() {
return TYPE_LOCAL;
}
-
+
public boolean hasLocalOperand() {
return true;
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/LongForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/LongForm.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/LongForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/LongForm.java Tue Jan 29 07:53:23 2008
@@ -25,7 +25,7 @@
* long references).
*/
public class LongForm extends ReferenceForm {
-
+
public LongForm(int opcode, String name, int[] rewrite) {
super(opcode, name, rewrite);
// TODO Auto-generated constructor stub
@@ -34,7 +34,7 @@
public int getOperandType() {
return TYPE_LONG;
}
-
+
public boolean hasLongOperand() {
return true;
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/LookupSwitchForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/LookupSwitchForm.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/LookupSwitchForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/LookupSwitchForm.java Tue Jan 29 07:53:23 2008
@@ -55,35 +55,35 @@
// All this gets dumped into the rewrite bytes of the
// poor bytecode.
-
-
+
+
// Unlike most byte codes, the LookupSwitch is a
// variable-sized bytecode. Because of this, the
// rewrite array has to be defined here individually
// for each bytecode, rather than in the ByteCodeForm
// class.
-
+
// First, there's the bytecode. Then there are 0-3
// bytes of padding so that the first (default)
// label is on a 4-byte offset.
- int padLength = 3 - (codeLength % 4);
+ int padLength = 3 - (codeLength % 4);
int rewriteSize = 1 + padLength + 4 // defaultbytes
+ 4 // npairs
+ (4 * case_values.length)
+ (4 * case_pcs.length);
-
+
int[] newRewrite = new int[rewriteSize];
int rewriteIndex = 0;
-
+
// Fill in what we can now
// opcode
newRewrite[rewriteIndex++] = byteCode.getOpcode();
-
+
// padding
for(int index=0; index < padLength; index++) {
newRewrite[rewriteIndex++] = 0;
}
-
+
// defaultbyte
// This gets overwritten by fixUpByteCodeTargets
newRewrite[rewriteIndex++] = -1;
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/MultiANewArrayForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/MultiANewArrayForm.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/MultiANewArrayForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/MultiANewArrayForm.java Tue Jan 29 07:53:23 2008
@@ -37,7 +37,7 @@
public int getOperandType() {
return TYPE_MULTIANEWARRAY;
}
-
+
public boolean hasMultianewarrayOperand() {
return true;
}
@@ -54,7 +54,7 @@
// multianewarray has a class ref and a dimension.
// The superclass handles the class ref.
super.setByteCodeOperands(byteCode, operandManager, codeLength);
-
+
// We have to handle the dimension.
int dimension = operandManager.nextByte();
byteCode.setOperandByte(dimension, 2);
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/NewInitMethodRefForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/NewInitMethodRefForm.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/NewInitMethodRefForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/NewInitMethodRefForm.java Tue Jan 29 07:53:23 2008
@@ -38,7 +38,7 @@
public int getOperandType() {
return TYPE_NEWINITMETHODREF;
}
-
+
public boolean hasNewInitMethodRefOperand() {
return true;
}
@@ -47,7 +47,7 @@
String result = operandManager.getNewClass();
return result;
}
-
+
protected void setNestedEntries(ByteCode byteCode, OperandManager operandManager, int offset) throws Pack200Exception {
SegmentConstantPool globalPool = operandManager.globalConstantPool();
ClassFileEntry[] nested = null;
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/NoArgumentForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/NoArgumentForm.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/NoArgumentForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/NoArgumentForm.java Tue Jan 29 07:53:23 2008
@@ -35,11 +35,11 @@
public int getOperandType() {
return TYPE_NONE;
}
-
+
public boolean hasNoOperand() {
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)
*/
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ReferenceForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ReferenceForm.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ReferenceForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ReferenceForm.java Tue Jan 29 07:53:23 2008
@@ -35,7 +35,7 @@
protected abstract int getPoolID();
protected abstract int getOffset(OperandManager operandManager);
-
+
protected void setNestedEntries(ByteCode byteCode, OperandManager operandManager, int offset) throws Pack200Exception {
SegmentConstantPool globalPool = operandManager.globalConstantPool();
ClassFileEntry[] nested = null;
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ShortForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ShortForm.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ShortForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ShortForm.java Tue Jan 29 07:53:23 2008
@@ -33,7 +33,7 @@
public int getOperandType() {
return TYPE_SHORT;
}
-
+
public boolean hasShortOperand() {
return true;
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SingleByteReferenceForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SingleByteReferenceForm.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SingleByteReferenceForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/SingleByteReferenceForm.java Tue Jan 29 07:53:23 2008
@@ -28,7 +28,7 @@
public abstract class SingleByteReferenceForm extends ReferenceForm {
protected boolean widened = false;
-
+
public SingleByteReferenceForm(int opcode, String name,
int[] rewrite) {
super(opcode, name, rewrite);
@@ -38,13 +38,13 @@
protected abstract int getOffset(OperandManager operandManager);
protected abstract int getPoolID();
-
+
protected void setNestedEntries(ByteCode byteCode, OperandManager operandManager, int offset) throws Pack200Exception {
super.setNestedEntries(byteCode, operandManager, offset);
if(widened) {
byteCode.setNestedPositions(new int[][] {{0,2}});
} else {
- byteCode.setNestedPositions(new int[][] {{0,1}});
+ byteCode.setNestedPositions(new int[][] {{0,1}});
}
}
}
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=616407&r1=616406&r2=616407&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 Tue Jan 29 07:53:23 2008
@@ -55,7 +55,7 @@
protected int getPoolID() {
return SegmentConstantPool.CP_STRING;
}
-
+
protected void setNestedEntries(ByteCode byteCode, OperandManager operandManager, int offset) throws Pack200Exception {
SegmentConstantPool globalPool = operandManager.globalConstantPool();
ClassFileEntry[] nested = null;
@@ -66,7 +66,7 @@
if(widened) {
byteCode.setNestedPositions(new int[][]{{0, 2}});
} else {
- byteCode.setNestedPositions(new int[][]{{0, 1}});
+ byteCode.setNestedPositions(new int[][]{{0, 1}});
}
}
}
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=616407&r1=616406&r2=616407&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 Tue Jan 29 07:53:23 2008
@@ -37,7 +37,7 @@
public int getOperandType() {
return TYPE_SUPERFIELDREF;
}
-
+
public boolean hasSuperFieldRefOperand() {
return true;
}
@@ -49,7 +49,7 @@
protected int getPoolID() {
return SegmentConstantPool.CP_FIELD;
}
-
+
protected String context(OperandManager operandManager) {
return operandManager.getSuperClass();
}
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=616407&r1=616406&r2=616407&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 Tue Jan 29 07:53:23 2008
@@ -23,7 +23,7 @@
*/
public class SuperInitMethodRefForm extends InitMethodReferenceForm {
- public SuperInitMethodRefForm(int opcode, String name,
+ public SuperInitMethodRefForm(int opcode, String name,
int[] rewrite) {
super(opcode, name, rewrite);
// TODO Auto-generated constructor stub
@@ -32,7 +32,7 @@
public int getOperandType() {
return TYPE_SUPERINITMETHODREF;
}
-
+
public boolean hasSuperInitMethodRefOperand() {
return true;
}
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=616407&r1=616406&r2=616407&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 Tue Jan 29 07:53:23 2008
@@ -37,11 +37,11 @@
public int getOperandType() {
return TYPE_SUPERMETHODREF;
}
-
+
public boolean hasSuperMethodRefOperand() {
return true;
}
-
+
protected int getOffset(OperandManager operandManager) {
return operandManager.nextSuperMethodRef();
}
@@ -49,7 +49,7 @@
protected int getPoolID() {
return SegmentConstantPool.CP_METHOD;
}
-
+
protected String context(OperandManager operandManager) {
return operandManager.getSuperClass();
}
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=616407&r1=616406&r2=616407&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 Tue Jan 29 07:53:23 2008
@@ -35,18 +35,18 @@
public int getOperandType() {
return TYPE_SWITCH;
}
-
+
public boolean hasSwitchOperand() {
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)
*/
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)
*/
@@ -55,7 +55,7 @@
int[] originalTargets = byteCode.getByteCodeTargets();
int numberOfLabels = originalTargets.length;
int[] replacementTargets = new int[numberOfLabels];
-
+
int sourceIndex = byteCode.getByteCodeIndex();
int sourceValue = ((Integer)codeAttribute.byteCodeOffsets.get(sourceIndex)).intValue();
for(int index=0; index < numberOfLabels; index++) {
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=616407&r1=616406&r2=616407&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 Tue Jan 29 07:53:23 2008
@@ -20,7 +20,7 @@
import org.apache.harmony.pack200.bytecode.OperandManager;
public class TableSwitchForm extends SwitchForm {
-
+
public TableSwitchForm(int opcode, String name) {
super(opcode, name);
}
@@ -29,7 +29,7 @@
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)
*/
@@ -63,28 +63,28 @@
// rewrite array has to be defined here individually
// for each bytecode, rather than in the ByteCodeForm
// class.
-
+
// First, there's the bytecode. Then there are 0-3
// bytes of padding so that the first (default)
// label is on a 4-byte offset.
- int padLength = 3 - (codeLength % 4);
+ int padLength = 3 - (codeLength % 4);
int rewriteSize = 1 + padLength + 4 // defaultbytes
+ 4 // lowbyte
+ 4 // highbyte
+ (4 * case_pcs.length);
-
+
int[] newRewrite = new int[rewriteSize];
int rewriteIndex = 0;
-
+
// Fill in what we can now
// opcode
newRewrite[rewriteIndex++] = byteCode.getOpcode();
-
+
// padding
for(int index=0; index < padLength; index++) {
newRewrite[rewriteIndex++] = 0;
}
-
+
// defaultbyte
// This gets overwritten by fixUpByteCodeTargets
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=616407&r1=616406&r2=616407&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 Tue Jan 29 07:53:23 2008
@@ -49,7 +49,7 @@
protected int getPoolID() {
return SegmentConstantPool.CP_FIELD;
}
-
+
protected String context(OperandManager operandManager) {
return operandManager.getCurrentClass();
}
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=616407&r1=616406&r2=616407&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 Tue Jan 29 07:53:23 2008
@@ -28,7 +28,7 @@
*/
public class ThisMethodRefForm extends ClassSpecificReferenceForm {
- public ThisMethodRefForm(int opcode, String name,
+ public ThisMethodRefForm(int opcode, String name,
int[] rewrite) {
super(opcode, name, rewrite);
// TODO Auto-generated constructor stub
@@ -37,11 +37,11 @@
public int getOperandType() {
return TYPE_THISMETHODREF;
}
-
+
public boolean hasThisMethodRefOperand() {
return true;
}
-
+
protected int getOffset(OperandManager operandManager) {
return operandManager.nextThisMethodRef();
}
@@ -49,7 +49,7 @@
protected int getPoolID() {
return SegmentConstantPool.CP_METHOD;
}
-
+
protected String context(OperandManager operandManager) {
return operandManager.getCurrentClass();
}
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=616407&r1=616406&r2=616407&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 Tue Jan 29 07:53:23 2008
@@ -37,7 +37,7 @@
* 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
@@ -50,13 +50,13 @@
* 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)
@@ -75,7 +75,7 @@
* 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
@@ -88,13 +88,13 @@
* 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)
@@ -119,13 +119,13 @@
if(absPosition < 0) {
throw new Error("Trying to rewrite " + this + " but there is no room for 4 bytes");
}
-
+
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");
}
-
+
rewrite[absPosition] = ((0xFF000000) & operand) >> 24;
rewrite[absPosition + 1] = ((0x00FF0000) & operand) >> 16;
rewrite[absPosition + 2] = ((0x0000FF00) & operand) >> 8;
@@ -145,13 +145,13 @@
if(absPosition < 0) {
throw new Error("Trying to rewrite " + this + " but there is no room for 4 bytes");
}
-
+
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");
}
-
+
rewrite[absPosition] = ((0xFF00) & operand) >> 8;
rewrite[absPosition + 1] = ((0x00FF) & operand);
}
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=616407&r1=616406&r2=616407&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 Tue Jan 29 07:53:23 2008
@@ -38,7 +38,7 @@
public int getOperandType() {
return TYPE_WIDE;
}
-
+
public boolean hasWideOperand() {
return true;
}
@@ -67,7 +67,7 @@
*/
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
// distinct here. This is so changing one will
@@ -76,31 +76,31 @@
// differ, so an updater will not have to disentangle
// it.
int local = operandManager.nextLocal();
-
+
// Unlike most byte codes, the wide bytecode is a
// variable-sized bytecode. Because of this, the
// rewrite array has to be defined here individually
// for each bytecode, rather than in the ByteCodeForm
// class.
-
+
int[] newRewrite = new int[4];
int rewriteIndex = 0;
-
+
// Fill in what we can now
// wide opcode
newRewrite[rewriteIndex++] = byteCode.getOpcode();
-
+
// "real" instruction that is widened
newRewrite[rewriteIndex++] = instruction;
// Index bytes
setRewrite2Bytes(local, rewriteIndex, newRewrite);
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
@@ -112,34 +112,34 @@
*/
protected void setByteCodeOperandsFormat2(int instruction, ByteCode byteCode,
OperandManager operandManager, int codeLength) {
-
- int local = operandManager.nextLocal();
+
+ int local = operandManager.nextLocal();
int constWord = operandManager.nextShort();
-
+
// Unlike most byte codes, the wide bytecode is a
// variable-sized bytecode. Because of this, the
// rewrite array has to be defined here individually
// for each bytecode, rather than in the ByteCodeForm
// class.
-
+
int[] newRewrite = new int[6];
int rewriteIndex = 0;
-
+
// Fill in what we can now
// wide opcode
newRewrite[rewriteIndex++] = byteCode.getOpcode();
-
+
// "real" instruction that is widened
newRewrite[rewriteIndex++] = instruction;
// Index bytes
setRewrite2Bytes(local, rewriteIndex, newRewrite);
rewriteIndex +=2;
-
+
// constant bytes
setRewrite2Bytes(constWord, rewriteIndex, newRewrite);
rewriteIndex += 2; // not strictly necessary, but just in case something comes along later
-
+
byteCode.setRewrite(newRewrite);
}
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200Adapter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200Adapter.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200Adapter.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200Adapter.java Tue Jan 29 07:53:23 2008
@@ -49,7 +49,7 @@
support.removePropertyChangeListener(listener);
}
- /**
+ /**
* Completion between 0..1
* @param value
*/
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200UnpackerAdapter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200UnpackerAdapter.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200UnpackerAdapter.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200UnpackerAdapter.java Tue Jan 29 07:53:23 2008
@@ -36,7 +36,7 @@
public class Pack200UnpackerAdapter extends Pack200Adapter implements Unpacker {
/*
* (non-Javadoc)
- *
+ *
* @see java.util.jar.Pack200.Unpacker#unpack(java.io.InputStream,
* java.util.jar.JarOutputStream)
*/
@@ -60,7 +60,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see java.util.jar.Pack200.Unpacker#unpack(java.io.File,
* java.util.jar.JarOutputStream)
*/
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=616407&r1=616406&r2=616407&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 Tue Jan 29 07:53:23 2008
@@ -37,7 +37,7 @@
public int getClassCount() {
return numClasses;
}
-
+
public SegmentOptions getOptions() {
try {
return new SegmentOptions(0);
@@ -52,7 +52,7 @@
public MockAttributeDefinitionBands(Segment segment) {
super(segment);
}
-
+
public AttributeLayoutMap getAttributeDefinitionMap() {
try {
return new AttributeLayoutMap();
@@ -61,21 +61,21 @@
}
return null;
}
-
-
+
+
}
public class MockSegment extends Segment {
-
+
protected AttrDefinitionBands getAttrDefinitionBands() {
return new MockAttributeDefinitionBands(this);
- }
-
+ }
+
public SegmentHeader getSegmentHeader() {
return new MockSegmentHeader();
}
}
-
-
+
+
}
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=616407&r1=616406&r2=616407&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 Tue Jan 29 07:53:23 2008
@@ -43,6 +43,6 @@
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=616407&r1=616406&r2=616407&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 Tue Jan 29 07:53:23 2008
@@ -45,7 +45,7 @@
return null;
return data[cp][(int)index];
}
-
+
};
}
}
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=616407&r1=616406&r2=616407&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 Tue Jan 29 07:53:23 2008
@@ -30,12 +30,12 @@
*/
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);
-
+
// Test encode-decode with a selection of numbers within the range of the codec
long delta = (codec.largest() - codec.smallest()) / 4;
for (long j = codec.smallest(); j <= codec.largest() + 1; j += delta) {
@@ -47,11 +47,11 @@
+ ", got: " + decoded);
}
}
-
- // Test encode-decode with 0
+
+ // Test encode-decode with 0
assertEquals(0, codec.decode(new ByteArrayInputStream(codec.encode(
0, 0)), 0));
}
}
-
+
}
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=616407&r1=616406&r2=616407&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 Tue Jan 29 07:53:23 2008
@@ -31,7 +31,7 @@
import org.apache.harmony.pack200.SegmentHeader;
public class BandSetTest extends TestCase {
-
+
public class MockSegment extends Segment {
public SegmentHeader getSegmentHeader() {
return new SegmentHeader();
@@ -45,9 +45,9 @@
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};
@@ -57,7 +57,7 @@
assertEquals("Wrong value in position " + i, ints[i], bytes[i]);
}
}
-
+
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};
@@ -65,39 +65,39 @@
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]);
- }
+ }
//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
InputStream in = new ByteArrayInputStream(bytes);
long[] longs = bandSet.decodeBandLong("Test Band", in, codec, 5);
for (int i = 0; i < longs.length; i++) {
assertEquals("Wrong value in position " + i, longs[i], bytes[i + 1]);
- }
+ }
}
-
+
public void testParseFlags1() {
-
+
}
-
+
public void testParseFlags2() {
-
+
}
-
+
public void testParseFlags3() {
-
+
}
-
+
public void testParseReferences1() {
-
+
}
-
+
public void testParseReferences2() {
-
+
}
}
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=616407&r1=616406&r2=616407&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 Tue Jan 29 07:53:23 2008
@@ -22,19 +22,12 @@
import java.util.ArrayList;
import org.apache.harmony.pack200.AttrDefinitionBands;
-import org.apache.harmony.pack200.AttributeLayoutMap;
-import org.apache.harmony.pack200.BandSet;
import org.apache.harmony.pack200.BcBands;
import org.apache.harmony.pack200.ClassBands;
import org.apache.harmony.pack200.CpBands;
import org.apache.harmony.pack200.Pack200Exception;
import org.apache.harmony.pack200.Segment;
import org.apache.harmony.pack200.SegmentConstantPool;
-import org.apache.harmony.pack200.SegmentHeader;
-import org.apache.harmony.pack200.bytecode.Attribute;
-import org.apache.harmony.pack200.bytecode.LineNumberTableAttribute;
-
-import junit.framework.TestCase;
/**
* Tests for Pack200 bytecode bands
@@ -53,7 +46,7 @@
public MockCpBands(Segment segment) {
super(segment);
}
-
+
public String[] getCpString() {
String[] classes = new String[100];
for(int index=0; index < 100; index++) {
@@ -65,31 +58,31 @@
public String[] getCpClass() {
return getCpString();
}
-
+
public String[] getCpFieldClass() {
return getCpClass();
}
-
+
public String[] getCpFieldDescriptor() {
return getCpString();
}
-
+
public String[] getCpMethodClass() {
return getCpClass();
}
-
+
public String[] getCpMethodDescriptor() {
return getCpString();
}
-
+
public String[] getCpIMethodClass() {
return getCpClass();
}
-
+
public String[] getCpIMethodDescriptor() {
return getCpString();
}
-
+
public int[] getCpInt() {
int[] elements = new int[100];
for(int index=0; index < 100; index++) {
@@ -103,7 +96,7 @@
for(int index=0; index < 100; index++) {
elements[index] = 1.0f;
}
- return elements;
+ return elements;
}
public long[] getCpLong() {
@@ -111,7 +104,7 @@
for(int index=0; index < 100; index++) {
elements[index] = 1L;
}
- return elements;
+ return elements;
}
public double[] getCpDouble() {
@@ -119,7 +112,7 @@
for(int index=0; index < 100; index++) {
elements[index] = 1.0D;
}
- return elements;
+ return elements;
}
}
@@ -127,7 +120,7 @@
public MockClassBands(Segment segment) {
super(segment);
}
-
+
public long[][] getMethodFlags() {
long[][] flags = new long[numClasses][] ;
for (int i = 0; i < flags.length; i++) {
@@ -135,7 +128,7 @@
}
return flags;
}
-
+
public int[] getCodeMaxStack() {
int totalMethods = 0;
for (int i = 0; i < numClasses; i++) {
@@ -143,7 +136,7 @@
}
return new int[totalMethods];
}
-
+
public int[] getCodeMaxNALocals() {
int totalMethods = 0;
for (int i = 0; i < numClasses; i++) {
@@ -151,7 +144,7 @@
}
return new int[totalMethods];
}
-
+
public String[][] getMethodDescr() {
String[][] descr = new String[numClasses][];
for (int i = 0; i < descr.length; i++) {
@@ -162,7 +155,7 @@
}
return descr;
}
-
+
public String[] getClassThis() {
String[] thisClasses = new String[numClasses];
for(int index=0; index < numClasses; index++) {
@@ -189,7 +182,7 @@
}
return attributes;
}
-
+
public ArrayList getOrderedCodeAttributes() {
int totalMethods = 0;
for(int classIndex = 0; classIndex < numMethods.length; classIndex++) {
@@ -209,29 +202,29 @@
protected AttrDefinitionBands getAttrDefinitionBands() {
return new MockAttributeDefinitionBands(this);
}
-
+
protected CpBands getCpBands() {
if(null == cpBands) {
cpBands = new MockCpBands(this);
}
return cpBands;
}
-
+
protected ClassBands getClassBands() {
return new MockClassBands(this);
}
-
+
public SegmentConstantPool getConstantPool() {
return cpBands.getConstantPool();
}
}
BcBands bcBands = new BcBands(new MockSegment());
-
+
/**
* Test with single byte instructions that mean all other bands apart from
* bc_codes will be empty.
- *
+ *
* @throws IOException
* @throws Pack200Exception
*/
@@ -249,16 +242,16 @@
(byte) 140, (byte) 141, (byte) 142, (byte) 143, (byte) 144,
(byte) 145, (byte) 146, (byte) 147, (byte) 148, (byte) 149,
(byte) 150, (byte) 151, (byte) 172, (byte) 173, (byte) 174,
- (byte) 175, (byte) 176, (byte) 177, (byte) 190, (byte) 191,
+ (byte) 175, (byte) 176, (byte) 177, (byte) 190, (byte) 191,
(byte) 194, (byte) 195, (byte) 255 };
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(bytes.length - 1, bcBands.getMethodByteCodePacked()[0][0].length);
}
-
+
/**
* Test with multiple classes but single byte instructions
- *
+ *
* @throws IOException
* @throws Pack200Exception
*/
@@ -270,11 +263,11 @@
bcBands.unpack(in);
assertEquals(2, bcBands.getMethodByteCodePacked()[0][0].length);
assertEquals(2, bcBands.getMethodByteCodePacked()[0][0].length);
-
+
numClasses = 1;
numMethods = new int[] {1};
}
-
+
/**
* Test with multiple classes and multiple methods but single byte instructions
* @throws IOException
@@ -288,22 +281,22 @@
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
- * @throws Pack200Exception
- * @throws IOException
+ * @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,
+ 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);
@@ -316,22 +309,22 @@
assertEquals(0, bc_case_value[1]);
assertEquals(9, bcBands.getBcLabel().length);
}
-
+
/**
* Test with codes that should require entries in the bc_byte band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcByteBand() throws IOException, Pack200Exception {
- byte[] bytes = new byte[] {16, (byte)132, (byte)188, (byte)197, (byte)255,
+ 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))
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(4, bcBands.getMethodByteCodePacked()[0][0].length);
- int[] bc_byte = bcBands.getBcByte();
+ int[] bc_byte = bcBands.getBcByte();
assertEquals(4, bc_byte.length);
for (int i = 0; i < bc_byte.length; i++) {
assertEquals(8, bc_byte[i]);
@@ -339,16 +332,16 @@
assertEquals(1, bcBands.getBcLocal().length);
assertEquals(1, bcBands.getBcClassRef().length);
}
-
+
/**
* Test with codes that should require entries in the bc_short band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @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,
+ byte[] bytes = new byte[] {17, (byte)196, (byte)132, (byte)255,
8, 8,// bc_short band
8, 8, 8, 8}; // bc_locals band (required by wide iinc (196, 132))
InputStream in = new ByteArrayInputStream(bytes);
@@ -357,15 +350,15 @@
assertEquals(2, bcBands.getBcShort().length);
assertEquals(2, bcBands.getBcLocal().length);
}
-
+
/**
* Test with codes that should require entries in the bc_local band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcLocalBand() throws IOException, Pack200Exception {
- byte[] bytes = new byte[] {21, 22, 23, 24, 25,
+ 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);
@@ -373,12 +366,12 @@
assertEquals(11, bcBands.getMethodByteCodePacked()[0][0].length);
assertEquals(11, bcBands.getBcLocal().length);
}
-
+
/**
* Test with codes that should require entries in the bc_label band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcLabelBand() throws IOException, Pack200Exception {
byte[] bytes = new byte[] {(byte) 159, (byte) 160, (byte) 161,
@@ -387,267 +380,267 @@
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
+// 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);
assertEquals(20, bcBands.getBcLabel().length);
}
-
+
public void testWideForms() throws IOException, Pack200Exception {
byte[] bytes = new byte[] {(byte) 196, (byte) 54, // wide istore
(byte) 196, (byte) 132, // wide iinc
- (byte) 255,
+ (byte) 255,
0, // bc_short band
- 0, 0, 0, 1}; // bc_locals band
+ 0, 0, 0, 1}; // bc_locals band
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(4, bcBands.getMethodByteCodePacked()[0][0].length);
assertEquals(4, bcBands.getBcLocal().length);
assertEquals(1, bcBands.getBcShort().length);
}
-
+
/**
* Test with codes that should require entries in the bc_intref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @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);
- int[] bc_intref = bcBands.getBcIntRef();
+ int[] bc_intref = bcBands.getBcIntRef();
assertEquals(2, bc_intref.length);
}
-
+
/**
* Test with codes that should require entries in the bc_floatref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @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);
- int[] bc_floatref = bcBands.getBcFloatRef();
+ int[] bc_floatref = bcBands.getBcFloatRef();
assertEquals(2, bc_floatref.length);
}
-
+
/**
* Test with codes that should require entries in the bc_longref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @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);
- int[] bc_longref = bcBands.getBcLongRef();
+ int[] bc_longref = bcBands.getBcLongRef();
assertEquals(1, bc_longref.length);
}
-
+
/**
* Test with codes that should require entries in the bc_doubleref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @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);
- int[] bc_doubleref = bcBands.getBcDoubleRef();
- assertEquals(1, bc_doubleref.length);
+ int[] bc_doubleref = bcBands.getBcDoubleRef();
+ assertEquals(1, bc_doubleref.length);
}
-
-
+
+
/**
* Test with codes that should require entries in the bc_stringref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @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);
- int[] bc_stringref = bcBands.getBcStringRef();
+ int[] bc_stringref = bcBands.getBcStringRef();
assertEquals(2, bc_stringref.length);
}
-
-
+
+
/**
* Test with codes that should require entries in the bc_classref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @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);
- int[] bc_classref = bcBands.getBcClassRef();
- assertEquals(2, bc_classref.length);
+ int[] bc_classref = bcBands.getBcClassRef();
+ assertEquals(2, bc_classref.length);
}
-
+
/**
* Test with codes that should require entries in the bc_fieldref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @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);
- int[] bc_fieldref = bcBands.getBcFieldRef();
+ int[] bc_fieldref = bcBands.getBcFieldRef();
assertEquals(4, bc_fieldref.length);
}
-
+
/**
* Test with codes that should require entries in the bc_methodref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @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);
- int[] bc_methodref = bcBands.getBcMethodRef();
+ int[] bc_methodref = bcBands.getBcMethodRef();
assertEquals(3, bc_methodref.length);
}
-
+
/**
* Test with codes that should require entries in the bc_imethodref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @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);
- int[] bc_imethodref = bcBands.getBcIMethodRef();
- assertEquals(1, bc_imethodref.length);
+ int[] bc_imethodref = bcBands.getBcIMethodRef();
+ assertEquals(1, bc_imethodref.length);
}
-
+
/**
* Test with codes that should require entries in the bc_thisfieldref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @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,
+ (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);
- int[] bc_thisfield = bcBands.getBcThisField();
+ int[] bc_thisfield = bcBands.getBcThisField();
assertEquals(8, bc_thisfield.length);
}
-
+
/**
* Test with codes that should require entries in the bc_superfield band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @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);
- int[] bc_superfield = bcBands.getBcSuperField();
- assertEquals(8, bc_superfield.length);
+ int[] bc_superfield = bcBands.getBcSuperField();
+ assertEquals(8, bc_superfield.length);
}
-
+
/**
* Test with codes that should require entries in the bc_thismethod band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @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);
- int[] bc_thismethod = bcBands.getBcThisMethod();
+ int[] bc_thismethod = bcBands.getBcThisMethod();
assertEquals(6, bc_thismethod.length);
}
-
+
/**
* Test with codes that should require entries in the bc_supermethod band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @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
+ 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);
- int[] bc_supermethod = bcBands.getBcSuperMethod();
+ int[] bc_supermethod = bcBands.getBcSuperMethod();
assertEquals(6, bc_supermethod.length);
}
-
+
/**
* Test with codes that should require entries in the bc_initrefref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @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
+ 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);
- int[] bc_initrefref = bcBands.getBcInitRef();
+ int[] bc_initrefref = bcBands.getBcInitRef();
assertEquals(3, bc_initrefref.length);
}
-
+
public void testBcEscRefBands() throws IOException, Pack200Exception {
// TODO
}
-
+
public void testBcEscBands() throws IOException, Pack200Exception {
// TODO
}
-
+
}
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=616407&r1=616406&r2=616407&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 Tue Jan 29 07:53:23 2008
@@ -29,45 +29,45 @@
*
*/
public class ClassBandsTest extends AbstractBandsTestCase {
-
+
private String[] cpClasses;
private String[] cpDescriptor;
private String[] cpUTF8;
-
+
public class MockCpBands extends CpBands {
public MockCpBands(Segment segment) {
super(segment);
}
-
+
public String[] getCpClass() {
return cpClasses;
}
-
+
public String[] getCpDescriptor() {
return cpDescriptor;
}
-
+
public String[] getCpUTF8() {
return cpUTF8;
}
-
+
public int[] getCpInt() {
return new int[0];
}
-
+
public double[] getCpDouble() {
return new double[0];
}
-
+
public long[] getCpLong() {
- return new long[0];
+ return new long[0];
}
-
+
public float[] getCpFloat() {
return new float[0];
}
-
+
public String[] getCpSignature() {
return new String[0];
}
@@ -78,11 +78,11 @@
return new MockCpBands(this);
}
}
-
-
-
+
+
+
ClassBands classBands = new ClassBands(new MockSegment());
-
+
public void testSimple() throws IOException, Pack200Exception {
cpClasses = new String[] { "Class1", "Class2", "Class3", "Interface1", "Interface2" };
cpDescriptor = new String[0];
@@ -119,7 +119,7 @@
assertEquals(cpClasses[4], classBands.getClassInterfaces()[0][1]);
cpClasses = null;
}
-
+
public void testWithMethods() throws Pack200Exception, IOException {
cpClasses = new String[] { "Class1", "Class2", "Class3" };
cpDescriptor = new String[] {"method1", "method2", "method3"};
@@ -133,7 +133,7 @@
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,
+ classInterfaceCount, classFieldCount, classMethodCount,
methodDescr, methodFlagsLo, classFlags, };
int total = 0;
for (int i = 0; i < allArrays.length; i++) {
@@ -156,15 +156,15 @@
assertEquals(cpDescriptor[0], classBands.getMethodDescr()[0][0]);
assertEquals(cpDescriptor[1], classBands.getMethodDescr()[0][1]);
assertEquals(cpDescriptor[2], classBands.getMethodDescr()[0][2]);
-
+
cpClasses = null;
cpDescriptor = null;
}
-
+
public void testWithFields() {
-
+
}
-
-
-
+
+
+
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodeAttributeTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodeAttributeTest.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodeAttributeTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodeAttributeTest.java Tue Jan 29 07:53:23 2008
@@ -123,7 +123,7 @@
Segment segment = new MockSegment();
CpBands cpBands = new MockCpBands(segment);
-
+
public byte[] mixedByteArray = { -47, // aload_0_getstatic_this 0, 1
-46, // aload_0_putstatic_this 4, 5
1, // aconst_null 8
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecEncodingTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecEncodingTest.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecEncodingTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecEncodingTest.java Tue Jan 29 07:53:23 2008
@@ -29,11 +29,11 @@
import org.apache.harmony.pack200.Pack200Exception;
/**
- *
+ *
*/
public class CodecEncodingTest extends TestCase {
-
- public void testCanonicalEncodings() throws IOException, Pack200Exception {
+
+ public void testCanonicalEncodings() throws IOException, Pack200Exception {
Codec defaultCodec = new BHSDCodec(2,16,0,0);
assertEquals(defaultCodec,CodecEncoding.getCodec(0,null, defaultCodec));
Map map = new HashMap();
@@ -162,5 +162,5 @@
assertEquals("(5,128,2,1)",CodecEncoding.getCodec(116,new ByteArrayInputStream(new byte[] { 0x25, (byte)0x7F}), null).toString());
assertEquals("(2,128,1,1)",CodecEncoding.getCodec(116,new ByteArrayInputStream(new byte[] { 0x0B, (byte)0x7F}), null).toString());
}
-
+
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecTest.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecTest.java Tue Jan 29 07:53:23 2008
@@ -159,7 +159,7 @@
assertTrue(byte2s.encodes(128));
assertTrue(byte2s.encodes(191));
assertFalse(byte2s.encodes(192));
- assertFalse(byte2s.encodes(256));
+ assertFalse(byte2s.encodes(256));
}
public void testRunCodec() throws Exception {
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ICTupleTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ICTupleTest.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ICTupleTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ICTupleTest.java Tue Jan 29 07:53:23 2008
@@ -20,7 +20,7 @@
import org.apache.harmony.pack200.IcTuple;
public class ICTupleTest extends TestCase {
-
+
public void testPredictedClassTupleParsing() {
IcTuple tuple = new IcTuple();
tuple.C = "orw/SimpleHelloWorld$SimpleHelloWorldInner";
@@ -54,7 +54,7 @@
assertEquals("1", tuple.simpleClassName());
assertEquals("java/util/AbstractList", tuple.outerClassString());
}
-
+
public void testExplicitClassTupleParsing() {
IcTuple tuple = new IcTuple();
tuple.C = "Foo$$2$Local";
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/PopulationCodecTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/PopulationCodecTest.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/PopulationCodecTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/PopulationCodecTest.java Tue Jan 29 07:53:23 2008
@@ -44,7 +44,7 @@
private void checkDecode(byte[] data, long[] expectedResult, Codec codec) throws IOException, Pack200Exception {
InputStream in = new ByteArrayInputStream(data );
-
+
long[] result = new PopulationCodec(codec,codec,codec).decode(expectedResult.length,in);
assertEquals(expectedResult.length,result.length);
for(int i=0;i<expectedResult.length;i++) {
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentConstantPoolTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentConstantPoolTest.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentConstantPoolTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentConstantPoolTest.java Tue Jan 29 07:53:23 2008
@@ -31,7 +31,7 @@
public MockSegmentConstantPool() {
super(new CpBands(new Segment()));
};
-
+
public int matchSpecificPoolEntryIndex(String[] classNameArray, String desiredClassName, int desiredIndex) {
return super.matchSpecificPoolEntryIndex(classNameArray, desiredClassName, desiredIndex);
};
@@ -53,13 +53,13 @@
assertEquals(3, mockInstance.matchSpecificPoolEntryIndex(testClassArray, "java/lang/String", 1));
assertEquals(4, mockInstance.matchSpecificPoolEntryIndex(testClassArray, "Object", 2));
assertEquals(5, mockInstance.matchSpecificPoolEntryIndex(testClassArray, "Other", 0));
-
+
// Elements that don't exist shouldn't be found
assertEquals(-1, mockInstance.matchSpecificPoolEntryIndex(testClassArray, "NotThere", 0));
-
+
// Elements that exist but don't have the requisite number
// of hits shouldn't be found.
- assertEquals(-1, mockInstance.matchSpecificPoolEntryIndex(testClassArray, "java/lang/String", 2));
+ assertEquals(-1, mockInstance.matchSpecificPoolEntryIndex(testClassArray, "java/lang/String", 2));
}
public void testMatchSpecificPoolEntryIndex_DoubleArray() throws Exception {
@@ -71,14 +71,14 @@
assertEquals(3, mockInstance.matchSpecificPoolEntryIndex(testClassArray, testMethodArray, "java/lang/String", "<init>.*", 0));
assertEquals(4, mockInstance.matchSpecificPoolEntryIndex(testClassArray, testMethodArray, "Object", "isNull.*", 0));
assertEquals(5, mockInstance.matchSpecificPoolEntryIndex(testClassArray, testMethodArray, "Other", "Other", 0));
-
+
// Elements that don't exist shouldn't be found
assertEquals(-1, mockInstance.matchSpecificPoolEntryIndex(testClassArray, testMethodArray, "NotThere", "NotThere", 0));
assertEquals(-1, mockInstance.matchSpecificPoolEntryIndex(testClassArray, testMethodArray, "Object", "NotThere", 0));
-
+
// Elements that exist but don't have the requisite number
// of hits shouldn't be found.
- assertEquals(-1, mockInstance.matchSpecificPoolEntryIndex(testClassArray, testMethodArray, "java/lang/String", "<init>.*", 1));
+ assertEquals(-1, mockInstance.matchSpecificPoolEntryIndex(testClassArray, testMethodArray, "java/lang/String", "<init>.*", 1));
}
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentOptionsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentOptionsTest.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentOptionsTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentOptionsTest.java Tue Jan 29 07:53:23 2008
@@ -22,10 +22,10 @@
import org.apache.harmony.pack200.SegmentOptions;
/**
- *
+ *
*/
public class SegmentOptionsTest extends TestCase {
-
+
public void testUnused() {
int[] unused = new int[] { 3, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 29, 30, 31 };