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 [2/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/SegmentConstantPool.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentConstantPool.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentConstantPool.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentConstantPool.java Tue Jan 29 07:53:23 2008
@@ -33,7 +33,7 @@
public class SegmentConstantPool {
/**
- *
+ *
*/
private CpBands bands;
@@ -89,13 +89,13 @@
throw new Error("Get value incomplete");
}
}
-
+
/**
* Subset the constant pool of the specified type
* to be just that which has the specified class
* name. Answer the ConstantPoolEntry at the
* desiredIndex of the subsetted pool.
- *
+ *
* @param cp type of constant pool array to search
* @param desiredIndex index of the constant pool
* @param desiredClassName class to use to generate a
@@ -117,9 +117,9 @@
throw new Error("Don't know how to handle " + cp);
}
realIndex = matchSpecificPoolEntryIndex(array, desiredClassName, index);
- return getConstantPoolEntry(cp, (long)realIndex);
+ return getConstantPoolEntry(cp, realIndex);
}
-
+
/**
* Given the name of a class, answer the CPClass associated
* with that class. Answer null if the class doesn't exist.
@@ -133,13 +133,13 @@
return null;
}
try {
- return getConstantPoolEntry(CP_CLASS, (long)index);
+ return getConstantPoolEntry(CP_CLASS, index);
}
catch (Pack200Exception ex) {
throw new Error("Error getting class pool entry");
}
}
-
+
/**
* Answer the init method for the specified class.
* @param cp constant pool to search (must be CP_METHOD)
@@ -156,7 +156,7 @@
} else {
throw new Error("Nothing but CP_METHOD can be an <init>");
}
- return getConstantPoolEntry(cp, (long)realIndex);
+ return getConstantPoolEntry(cp, realIndex);
}
/**
@@ -166,12 +166,12 @@
* fields defined in the superclass. Similarly, _this bytecodes
* use just those methods/fields defined in this class, and _init
* bytecodes use just those methods that start with <init>.
- *
+ *
* This method takes an array of names, a String to match for,
* an index and a boolean as parameters, and answers the array
* position in the array of the indexth element which matches
* (or equals) the String (depending on the state of the boolean)
- *
+ *
* In other words, if the class array consists of:
* Object [position 0, 0th instance of Object]
* String [position 1, 0th instance of String]
@@ -181,7 +181,7 @@
* then classSpecificPoolEntryIndex(..., "Object", 2, false) will
* answer 4. classSpecificPoolEntryIndex(..., "String", 0, false)
* will answer 1.
- *
+ *
* @param nameArray Array of Strings against which the compareString is tested
* @param compareString String for which to search
* @param desiredIndex nth element with that match (counting from 0)
@@ -199,7 +199,7 @@
* - the secondaryArray[index] .matches() the secondaryCompareString
* When the desiredIndex number of hits has been reached, the index
* into the original two arrays of the element hit is returned.
- *
+ *
* @param primaryArray The first array to search
* @param secondaryArray The second array (must be same .length as primaryArray)
* @param primaryCompareString The String to compare against primaryArray using .equals()
@@ -210,7 +210,7 @@
protected int matchSpecificPoolEntryIndex(String[] primaryArray, String[] secondaryArray, String primaryCompareString, String secondaryCompareRegex, int desiredIndex) {
int instanceCount = -1;
for(int index=0; index < primaryArray.length; index++) {
- if((primaryArray[index].equals(primaryCompareString)) &&
+ if((primaryArray[index].equals(primaryCompareString)) &&
secondaryArray[index].matches(secondaryCompareRegex)) {
instanceCount++;
if(instanceCount == desiredIndex) {
@@ -225,8 +225,8 @@
}
return -1;
}
-
-
+
+
public ConstantPoolEntry getConstantPoolEntry(int cp, long value) throws Pack200Exception {
int index = (int) value;
if (index == -1) {
@@ -264,7 +264,7 @@
throw new Error("Get value incomplete");
}
}
-
+
public ConstantPoolEntry[] getCpAll() throws Pack200Exception {
ArrayList cpAll = new ArrayList();
// TODO: this is 1.5-specific. Try to get rid
@@ -299,11 +299,11 @@
for(int index=0; index < bands.getCpIMethodClass().length; index++) {
cpAll.add(getConstantPoolEntry(CP_IMETHOD, index));
}
-
+
ConstantPoolEntry[] result = new ConstantPoolEntry[cpAll.size()];
cpAll.toArray(result);
return result;
}
-
+
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java Tue Jan 29 07:53:23 2008
@@ -22,11 +22,11 @@
import java.io.InputStream;
public class SegmentHeader {
-
+
private int archiveMajor;
- private int archiveMinor;
-
+ private int archiveMinor;
+
private long archiveModtime;
private long archiveSize;
@@ -74,14 +74,14 @@
private int segmentsRemaining;
private SegmentOptions options;
-
-
+
+
/**
* The magic header for a Pack200 Segment is 0xCAFED00D. I wonder where they
* get their inspiration from ...
*/
private static final int[] magic = { 0xCA, 0xFE, 0xD0, 0x0D };
-
+
public void unpack(InputStream in) throws IOException,
Pack200Exception, Error, Pack200Exception {
long word[] = decodeScalar("archive_magic_word", in, Codec.BYTE1,
@@ -99,17 +99,17 @@
parseArchiveSpecialCounts(in);
parseCpCounts(in);
parseClassCounts(in);
-
+
if (getBandHeadersSize() > 0) {
- byte[] bandHeaders = new byte[(int) getBandHeadersSize()];
+ byte[] bandHeaders = new byte[getBandHeadersSize()];
readFully(in, bandHeaders);
setBandHeadersData(bandHeaders);
}
}
-
+
/**
* Sets the minor version of this archive
- *
+ *
* @param version
* the minor version of the archive
* @throws Pack200Exception
@@ -120,10 +120,10 @@
throw new Pack200Exception("Invalid segment minor version");
archiveMinor = version;
}
-
+
/**
* Sets the major version of this archive.
- *
+ *
* @param version
* the minor version of the archive
* @throws Pack200Exception
@@ -134,7 +134,7 @@
throw new Pack200Exception("Invalid segment major version: " + version);
archiveMajor = version;
}
-
+
public long getArchiveModtime() {
return archiveModtime;
}
@@ -222,16 +222,16 @@
public long getArchiveSize() {
return archiveSize;
}
-
+
/**
* Obtain the band headers data as an input stream. If no band headers are
* present, this will return an empty input stream to prevent any further
* reads taking place.
- *
+ *
* Note that as a stream, data consumed from this input stream can't be
* re-used. Data is only read from this stream if the encoding is such that
* additional information needs to be decoded from the stream itself.
- *
+ *
* @return the band headers input stream
*/
public InputStream getBandHeadersInputStream() {
@@ -241,19 +241,19 @@
return bandHeadersInputStream;
}
-
+
public int getNumberOfFiles() {
return numberOfFiles;
}
-
+
public int getSegmentsRemaining() {
return segmentsRemaining;
}
-
+
public SegmentOptions getOptions() {
return options;
}
-
+
private void parseArchiveFileCounts(InputStream in) throws IOException,
Pack200Exception {
if (options.hasArchiveFileCounts()) {
@@ -276,7 +276,7 @@
in, Codec.UNSIGNED5));
}
}
-
+
private void parseClassCounts(InputStream in) throws IOException,
Pack200Exception {
innerClassCount = (int)decodeScalar("ic_count", in, Codec.UNSIGNED5);
@@ -286,7 +286,7 @@
Codec.UNSIGNED5);
classCount = (int)decodeScalar("class_count", in, Codec.UNSIGNED5);
}
-
+
private void parseCpCounts(InputStream in) throws IOException,
Pack200Exception {
cpUTF8Count = (int)decodeScalar("cp_Utf8_count", in, Codec.UNSIGNED5);
@@ -306,11 +306,11 @@
cpMethodCount = (int)decodeScalar("cp_Method_count", in, Codec.UNSIGNED5);
cpIMethodCount = (int)decodeScalar("cp_Imethod_count", in, Codec.UNSIGNED5);
}
-
+
/**
* Decode a number of scalars from the band file. A scalar is like a band,
* but does not perform any band code switching.
- *
+ *
* @param name
* the name of the scalar (primarily for logging/debugging
* purposes)
@@ -332,11 +332,11 @@
debug("Parsed #" + name + " (" + n + ")");
return codec.decode(n, in);
}
-
+
/**
* Decode a scalar from the band file. A scalar is like a band, but does not
* perform any band code switching.
- *
+ *
* @param name
* the name of the scalar (primarily for logging/debugging
* purposes)
@@ -358,7 +358,7 @@
debug("Parsed #" + name + " as " + ret);
return ret;
}
-
+
public void setArchiveModtime(long archiveModtime) {
this.archiveModtime = archiveModtime;
}
@@ -370,7 +370,7 @@
private void setAttributeDefinitionCount(long valuie) {
this.attributeDefinitionCount = (int) valuie;
}
-
+
private void setBandHeadersData(byte[] bandHeaders) {
this.bandHeadersInputStream = new ByteArrayInputStream(bandHeaders);
}
@@ -378,12 +378,12 @@
public void setSegmentsRemaining(long value) {
segmentsRemaining = (int) value;
}
-
+
/**
* Completely reads in a byte array, akin to the implementation in
* {@link java.lang.DataInputStream}. TODO Refactor out into a separate
* InputStream handling class
- *
+ *
* @param in
* the input stream to read from
* @param data
@@ -411,7 +411,7 @@
public int getBandHeadersSize() {
return bandHeadersSize;
}
-
+
protected void debug(String message) {
if (System.getProperty("debug.pack200") != null) {
System.err.println(message);
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentOptions.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentOptions.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentOptions.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentOptions.java Tue Jan 29 07:53:23 2008
@@ -61,7 +61,7 @@
/**
* Creates a new segment options with the given integer value.
- *
+ *
* @param options
* the integer value to use as the flags
* @throws Pack200Exception
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentUtils.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentUtils.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentUtils.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentUtils.java Tue Jan 29 07:53:23 2008
@@ -18,7 +18,7 @@
// TODO Write doc
public final class SegmentUtils {
-
+
public static int countArgs(String descriptor) {
return countArgs(descriptor, 1);
}
@@ -26,7 +26,7 @@
public static int countInvokeInterfaceArgs(String descriptor) {
return countArgs(descriptor, 2);
}
-
+
/**
* Count the number of arguments in the descriptor. Each
* long or double counts as widthOfLongsAndDoubles; all other
@@ -73,7 +73,7 @@
}
return count;
}
-
+
public static int countMatches(long[] flags, IMatcher matcher) {
int count = 0;
for (int i = 0; i < flags.length; i++) {
@@ -82,7 +82,7 @@
}
return count;
}
-
+
public static int countBit16(int[] flags) {
int count = 0;
for (int i = 0; i < flags.length; i++) {
@@ -91,7 +91,7 @@
}
return count;
}
-
+
public static int countBit16(long[] flags) {
int count = 0;
for (int i = 0; i < flags.length; i++) {
@@ -100,14 +100,14 @@
}
return count;
}
-
+
public static int countBit16(long[][] flags) {
int count = 0;
for (int i = 0; i < flags.length; i++) {
for (int j = 0; j < flags[i].length; j++) {
if ((flags[i][j] & (1 << 16)) != 0)
count++;
- }
+ }
}
return count;
}
@@ -126,12 +126,12 @@
* ic_relevant(classX)
* @param classX String class name
* @param ic_all ICTuple[] all the inner class tuples
- * @return ICTuple[] all the relevant tuples sorted as in
+ * @return ICTuple[] all the relevant tuples sorted as in
*/
public static IcTuple[] icRelevant(String classX, IcTuple[] ic_all) {
return null;
}
-
+
public static boolean isRelevant(String outerClass, IcTuple tuple) {
if(tuple.C.equals(outerClass)) {
// If the outer class name is explicitly
@@ -139,29 +139,29 @@
// tuple is relevant.
return true;
}
-
+
if(tuple.C != null) {
// If the outer class name is explicitly specified
// (non-null) and it's not the correct one, the
// tuple is not relevant.
return false;
}
-
+
// Now we know that tuple.C is null, so it might be
// relevant. Find out.
return false;
}
-
-
+
+
private SegmentUtils() {
// Intended to be a helper class
}
-
+
/**
* This is a debugging message to aid the developer in writing this
* class. If the property 'debug.pack200' is set, this will
* generate messages to stderr; otherwise, it will be silent.
- *
+ *
* @param message
* @deprecated this may be removed from production code
*/
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/AnnotationDefaultAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/AnnotationDefaultAttribute.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/AnnotationDefaultAttribute.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/AnnotationDefaultAttribute.java Tue Jan 29 07:53:23 2008
@@ -38,7 +38,7 @@
protected void writeBody(DataOutputStream dos) throws IOException {
element_value.writeBody(dos);
}
-
+
protected void resolve(ClassConstantPool pool) {
super.resolve(pool);
element_value.resolve(pool);
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/AnnotationsAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/AnnotationsAttribute.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/AnnotationsAttribute.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/AnnotationsAttribute.java Tue Jan 29 07:53:23 2008
@@ -24,29 +24,29 @@
*/
public abstract class AnnotationsAttribute extends Attribute {
-
+
/**
* Class to represent the annotation structure for class file attributes
*/
public static class Annotation {
-
+
private int num_pairs;
private CPUTF8[] element_names;
private ElementValue[] element_values;
private CPUTF8 type;
-
+
// Resolved values
private int type_index;
private int[] name_indexes;
-
-
+
+
public Annotation(int num_pairs, CPUTF8 type, CPUTF8[] element_names, ElementValue[] element_values) {
this.num_pairs = num_pairs;
this.type = type;
this.element_names = element_names;
this.element_values = element_values;
}
-
+
public int getLength() {
int length = 4;
for (int i = 0; i < num_pairs; i++) {
@@ -55,7 +55,7 @@
}
return length;
}
-
+
public void resolve(ClassConstantPool pool) {
type.resolve(pool);
type_index = pool.indexOf(type);
@@ -75,22 +75,22 @@
element_values[i].writeBody(dos);
}
}
-
+
}
public static class ElementValue {
-
+
private Object value;
private int tag;
-
+
// resolved value index if it's a constant
private int constant_value_index = -1;
-
+
public ElementValue(int tag, Object value) {
this.tag = tag;
this.value = value;
}
-
+
public void resolve(ClassConstantPool pool) {
if(value instanceof CPConstant) {
((CPConstant)value).resolve(pool);
@@ -100,7 +100,7 @@
constant_value_index = pool.indexOf((CPClass)value);
} else if (value instanceof CPNameAndType) {
((CPNameAndType)value).resolve(pool);
- } else if (value instanceof Annotation) {
+ } else if (value instanceof Annotation) {
((Annotation)value).resolve(pool);
} else if (value instanceof ElementValue[]) {
ElementValue[] nestedValues = (ElementValue[])value;
@@ -116,7 +116,7 @@
dos.writeShort(constant_value_index);
} else if (value instanceof CPNameAndType) {
((CPNameAndType)value).writeBody(dos);
- } else if (value instanceof Annotation) {
+ } else if (value instanceof Annotation) {
((Annotation)value).writeBody(dos);
} else if (value instanceof ElementValue[]) {
ElementValue[] nestedValues = (ElementValue[])value;
@@ -158,6 +158,6 @@
super(attributeName);
}
-
+
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/Attribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/Attribute.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/Attribute.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/Attribute.java Tue Jan 29 07:53:23 2008
@@ -62,7 +62,7 @@
* when attributes are nested within other attributes - the outer attribute
* needs to take the inner attribute headers into account when calculating
* its length.
- *
+ *
* @return int adjusted length
*/
protected int getLengthIncludingHeader() {
@@ -76,7 +76,7 @@
/**
* Answer true if the receiver needs to have BCI renumbering applied to it;
* otherwise answer false.
- *
+ *
* @return boolean BCI renumbering required
*/
public boolean hasBCIRenumbering() {
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/BCIRenumberedAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/BCIRenumberedAttribute.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/BCIRenumberedAttribute.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/BCIRenumberedAttribute.java Tue Jan 29 07:53:23 2008
@@ -25,23 +25,23 @@
public abstract class BCIRenumberedAttribute extends Attribute {
protected boolean renumbered = false;
-
+
/* (non-Javadoc)
* @see org.apache.harmony.pack200.bytecode.Attribute#hasBCIRenumbering()
*/
public boolean hasBCIRenumbering() {
return true;
}
-
+
public BCIRenumberedAttribute(String attributeName) {
super(attributeName);
}
-
+
protected abstract int getLength();
protected abstract void writeBody(DataOutputStream dos) throws IOException;
public abstract String toString();
protected abstract int[] getStartPCs();
-
+
/**
* In Pack200, line number tables are BCI renumbered.
* This method takes the byteCodeOffsets (which is
@@ -49,7 +49,7 @@
* byte code array of each instruction) and updates the
* start_pcs so that it points to the instruction index
* itself, not the BCI renumbering of the instruction.
- *
+ *
* @param byteCodeOffsets List of Integer offsets of the bytecode array
*/
public void renumber(List byteCodeOffsets) {
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ByteCode.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ByteCode.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ByteCode.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ByteCode.java Tue Jan 29 07:53:23 2008
@@ -124,22 +124,22 @@
for(int index = 0; index < nested.length; index++) {
int argLength = getNestedPosition(index)[1];
switch(argLength) {
-
+
case 1:
setOperandByte(pool.indexOf(nested[index]), getNestedPosition(index)[0]);
break;
-
- case 2:
+
+ case 2:
setOperand2Bytes(pool.indexOf(nested[index]), getNestedPosition(index)[0]);
break;
-
+
case 4:
// TODO: need to handle wides?
SegmentUtils.debug("Need to handle wides");
// figure out and if so, handle and put a break here.
// break;
-
- default:
+
+ default:
SegmentUtils.debug("Unhandled resolve " + this);
}
}
@@ -153,7 +153,7 @@
* operand to be the appropriate values. All values in
* operands[] will be masked with 0xFF so they fit into
* a byte.
- * @param operands int[] rewrite operand bytes
+ * @param operands int[] rewrite operand bytes
*/
public void setOperandBytes(int[] operands) {
int firstOperandIndex = getByteCodeForm().firstOperandIndex();
@@ -162,23 +162,23 @@
// No operand rewriting permitted for this bytecode
throw new Error("Trying to rewrite " + this + " that has no rewrite");
}
-
+
if(byteCodeFormLength != operands.length) {
throw new Error("Trying to rewrite " + this + " with " + operands.length + " but bytecode has length " + byteCodeForm.operandLength());
}
-
+
for(int index=0; index < byteCodeFormLength; index++) {
rewrite[index + firstOperandIndex] = operands[index] & 0xFF;
}
}
-
+
/**
* Given an int operand, set the rewrite bytes for
* that position and the one immediately following it
* to a high-byte, low-byte encoding of the operand.
- *
+ *
* @param operand int to set the rewrite bytes to
- * @param position int position in the operands of the
+ * @param position int position in the operands of the
* rewrite bytes. For a rewrite array of {100, -1, -1, -1}
* position 0 is the first -1, position 1 is the second -1,
* etc.
@@ -190,15 +190,15 @@
// No operand rewriting permitted for this bytecode
throw new Error("Trying to rewrite " + this + " that has no rewrite");
}
-
+
if(firstOperandIndex + position + 1 > byteCodeFormLength) {
throw new Error("Trying to rewrite " + this + " with an int at position " + position + " but this won't fit in the rewrite array");
}
-
+
rewrite[firstOperandIndex + position] = (operand & 0xFF00) >> 8;
rewrite[firstOperandIndex + position + 1] = operand & 0xFF;
}
-
+
/**
* This is just like setOperandInt, but takes special care when the
* operand is less than 0 to make sure it's written correctly.
@@ -218,9 +218,9 @@
* Given an int operand, treat it as a byte and set
* the rewrite byte for that position to that value.
* Mask of anything beyond 0xFF.
- *
+ *
* @param operand int to set the rewrite byte to (unsigned)
- * @param position int position in the operands of the
+ * @param position int position in the operands of the
* rewrite bytes. For a rewrite array of {100, -1, -1, -1}
* position 0 is the first -1, position 1 is the second -1,
* etc.
@@ -232,29 +232,29 @@
// No operand rewriting permitted for this bytecode
throw new Error("Trying to rewrite " + this + " that has no rewrite");
}
-
+
if(firstOperandIndex + position > byteCodeFormLength) {
throw new Error("Trying to rewrite " + this + " with an byte at position " + position + " but this won't fit in the rewrite array");
}
-
- rewrite[firstOperandIndex + position] = operand & 0xFF;
+
+ rewrite[firstOperandIndex + position] = operand & 0xFF;
}
-
-
+
+
public String toString() {
return getByteCodeForm().getName();
}
-
+
public void setNested(ClassFileEntry[] nested) {
this.nested = nested;
}
-
+
/**
* nestedPositions is an array of arrays of ints. Each
* subarray specifies a position of a nested
* element (from the nested[] array) and the length of
* that element.
- *
+ *
* For instance, one might have a nested of:
* {CPClass java/lang/Foo, CPFloat 3.14}
* The nestedPositions would then be:
@@ -265,17 +265,17 @@
* occurrences of -1). The CPFloat will be resolved to
* an int position and inserted at positions 2 and 3 of
* the rewrite arguments.
- *
+ *
* @param nestedPositions
*/
public void setNestedPositions(int[][] nestedPositions) {
this.nestedPositions = nestedPositions;
}
-
+
public int[][] getNestedPositions() {
return nestedPositions;
}
-
+
public int[] getNestedPosition(int index) {
return getNestedPositions()[index];
}
@@ -285,7 +285,7 @@
* a multi-bytecode instruction (such as
* aload0_putfield_super); otherwise, it will answer
* false.
- *
+ *
* @return boolean true if multibytecode, false otherwise
*/
public boolean hasMultipleByteCodes() {
@@ -298,10 +298,10 @@
* to know where they are in order to calculate their
* targets). This method lets the CodeAttribute specify
* where the byte code is.
- *
+ *
* Since there are no aload0+label instructions, this
* method doesn't worry about multioperation bytecodes.
- *
+ *
* @param byteCodeOffset int position in code array.
*/
public void setByteCodeIndex(int byteCodeOffset) {
@@ -312,7 +312,7 @@
public int getByteCodeIndex() {
return byteCodeOffset;
}
-
+
/**
* Some ByteCodes (in particular, those with labels)
* have to keep track of byteCodeTargets. These are
@@ -320,17 +320,17 @@
* relative to the byteCodeOffset, but later get fixed
* up to point to the absolute position in the CodeAttribute
* array. This method sets the targets.
- *
+ *
* @param byteCodeTarget int index in array
*/
public void setByteCodeTargets(int[] byteCodeTargets) {
this.byteCodeTargets = byteCodeTargets;
}
-
+
public int[] getByteCodeTargets() {
return byteCodeTargets;
}
-
+
/**
* Some ByteCodes (in particular, those with labels
* need to be fixed up after all the bytecodes in the
@@ -346,23 +346,23 @@
* Some bytecodes (the ones with variable lengths) can't
* have a static rewrite array - they need the ability to
* update the array. This method permits that.
- *
+ *
* Note that this should not be called from bytecodes
* which have a static rewrite; use the table in ByteCodeForm
* instead to specify those rewrites.
- *
+ *
* @param rewrite
*/
public void setRewrite(int[] rewrite) {
this.rewrite = rewrite;
}
-
+
/**
* Some bytecodes (the ones with variable lengths) can't
* have a static rewrite array - they need the ability to
* update the array. This method permits their associated
* bytecode formst to query their rewrite array.
- *
+ *
* Note that this should not be called from bytecodes
* which have a static rewrite; use the table in ByteCodeForm
* instead to specify those rewrites.
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPClass.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPClass.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPClass.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPClass.java Tue Jan 29 07:53:23 2008
@@ -19,8 +19,6 @@
import java.io.DataOutputStream;
import java.io.IOException;
-import org.apache.harmony.pack200.IcBands;
-
public class CPClass extends ConstantPoolEntry {
private int index;
@@ -36,7 +34,7 @@
this.utf8 = new CPUTF8(name, ClassConstantPool.DOMAIN_NORMALASCIIZ);
}
-
+
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -62,7 +60,7 @@
return new ClassFileEntry[] { utf8, };
}
-
+
public int hashCode() {
final int PRIME = 31;
int result = 1;
@@ -83,11 +81,11 @@
public String getName() {
return name;
}
-
+
protected void writeBody(DataOutputStream dos) throws IOException {
dos.writeShort(index);
}
-
+
public String comparisonString() {
// TODO: what to do about inner classes?
if(name==null) {return "null:name (probably an inner class?)";};
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPConstant.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPConstant.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPConstant.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPConstant.java Tue Jan 29 07:53:23 2008
@@ -26,7 +26,7 @@
this.value = value;
}
-
+
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -43,7 +43,7 @@
return true;
}
-
+
public int hashCode() {
final int PRIME = 31;
int result = 1;
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPDouble.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPDouble.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPDouble.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPDouble.java Tue Jan 29 07:53:23 2008
@@ -25,12 +25,12 @@
this.domain = ClassConstantPool.DOMAIN_DOUBLE;
}
-
+
protected void writeBody(DataOutputStream dos) throws IOException {
dos.writeDouble(getNumber().doubleValue());
}
-
+
public String toString() {
return "Double: " + getValue();
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPFieldRef.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPFieldRef.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPFieldRef.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPFieldRef.java Tue Jan 29 07:53:23 2008
@@ -36,13 +36,13 @@
}
-
+
protected ClassFileEntry[] getNestedClassFileEntries() {
return new ClassFileEntry[] {className, nameAndType};
}
-
+
protected void resolve(ClassConstantPool pool) {
super.resolve(pool);
nameAndTypeIndex = pool.indexOf(nameAndType);
@@ -54,7 +54,7 @@
dos.writeShort(nameAndTypeIndex);
}
-
+
public String toString() {
return "FieldRef: " + className + "#" + nameAndType;
}
@@ -62,7 +62,7 @@
public String comparisonString() {
return (className.getName() + Character.MAX_VALUE) + nameAndType.descriptor + Character.MAX_VALUE + nameAndType.name;
}
-
+
public int hashCode() {
final int PRIME = 31;
int result = 1;
@@ -72,7 +72,7 @@
}
-
+
public boolean equals(Object obj) {
if (this == obj)
return true;
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPFloat.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPFloat.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPFloat.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPFloat.java Tue Jan 29 07:53:23 2008
@@ -25,12 +25,12 @@
this.domain = ClassConstantPool.DOMAIN_FLOAT;
}
-
+
protected void writeBody(DataOutputStream dos) throws IOException {
dos.writeFloat(getNumber().floatValue());
}
-
+
public String toString() {
return "Float: " + getValue();
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPInteger.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPInteger.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPInteger.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPInteger.java Tue Jan 29 07:53:23 2008
@@ -26,12 +26,12 @@
this.domain = ClassConstantPool.DOMAIN_INTEGER;
}
-
+
protected void writeBody(DataOutputStream dos) throws IOException {
dos.writeInt(getNumber().intValue());
}
-
+
public String toString() {
return "Integer: " + getValue();
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPInterfaceMethodRef.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPInterfaceMethodRef.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPInterfaceMethodRef.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPInterfaceMethodRef.java Tue Jan 29 07:53:23 2008
@@ -28,7 +28,7 @@
* for an invokeinterface call. This is equal to 1 + the
* count of all the args, where longs and doubles count for
* 2 and all others count for 1.
- *
+ *
* @return integer count
*/
public int invokeInterfaceCount() {
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPLong.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPLong.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPLong.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPLong.java Tue Jan 29 07:53:23 2008
@@ -26,12 +26,12 @@
this.domain = ClassConstantPool.DOMAIN_LONG;
}
-
+
protected void writeBody(DataOutputStream dos) throws IOException {
dos.writeLong(getNumber().longValue());
}
-
+
public String toString() {
return "Long: " + getValue();
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPMember.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPMember.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPMember.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPMember.java Tue Jan 29 07:53:23 2008
@@ -45,7 +45,7 @@
}
-
+
protected ClassFileEntry[] getNestedClassFileEntries() {
int attributeCount = attributes.size();
ClassFileEntry[] entries = new ClassFileEntry[attributeCount+2];
@@ -58,7 +58,7 @@
}
-
+
protected void resolve(ClassConstantPool pool) {
super.resolve(pool);
nameIndex = pool.indexOf(name);
@@ -69,12 +69,12 @@
}
}
-
+
public String toString() {
return "Field: " + name + "(" + descriptor + ")";
}
-
+
public int hashCode() {
final int PRIME = 31;
int result = 1;
@@ -86,7 +86,7 @@
}
-
+
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -116,7 +116,7 @@
}
-
+
protected void doWrite(DataOutputStream dos) throws IOException {
dos.writeShort(flags);
dos.writeShort(nameIndex);
@@ -127,7 +127,7 @@
Attribute attribute = (Attribute) attributes.get(i);
attribute.doWrite(dos);
}
-
+
}
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPNameAndType.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPNameAndType.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPNameAndType.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPNameAndType.java Tue Jan 29 07:53:23 2008
@@ -68,7 +68,7 @@
return new ClassFileEntry[] { name, descriptor };
}
-
+
protected void resolve(ClassConstantPool pool) {
super.resolve(pool);
descriptorIndex = pool.indexOf(descriptor);
@@ -79,18 +79,18 @@
* field_info { u2 access_flags; u2 name_index; u2 descriptor_index; u2
* attributes_count; attribute_info attributes[attributes_count]; }
*/
-
+
protected void writeBody(DataOutputStream dos) throws IOException {
dos.writeShort(nameIndex);
dos.writeShort(descriptorIndex);
}
-
+
public String toString() {
return "NameAndType: " + name + "(" + descriptor + ")";
}
-
+
public int hashCode() {
final int PRIME = 31;
int result = 1;
@@ -99,7 +99,7 @@
return result;
}
-
+
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -131,14 +131,14 @@
public int invokeInterfaceCount() {
return 1 + SegmentUtils.countInvokeInterfaceArgs(descriptor.underlyingString());
}
-
+
/* (non-Javadoc)
* @see org.apache.harmony.pack200.bytecode.ConstantPoolEntry#comparisonString()
*/
public String comparisonString() {
// First come those things which don't have an
- // associated signature. Then come the native signatures,
+ // associated signature. Then come the native signatures,
// then finally the class signatures.
// TODO: I think Character.MAX_VALUE is no longer the
// biggest character, what with the weird codepage thing
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPRef.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPRef.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPRef.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPRef.java Tue Jan 29 07:53:23 2008
@@ -81,13 +81,13 @@
// This one is tricky. The sorting appears to be
// done based on the indices of the method descriptor
// and class name in the classpool *after* sorting them.
-
+
// If we haven't yet been resolved, just do a normal
// compare (so things like .contains() work).
if(!isResolved()) {
return super.comparisonString();
}
-
+
// If we get here, the receiver has been resolved; there
// is a different sort order.
StringBuffer result = new StringBuffer();
@@ -95,7 +95,7 @@
int padLength = 6;
int classIndexLength = ("" + classNameIndex).length();
int nameAndTypeIndexLength = ("" + nameAndTypeIndex).length();
-
+
for(int index=0; index < (padLength - classIndexLength); index++) {
result.append('0');
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPString.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPString.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPString.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPString.java Tue Jan 29 07:53:23 2008
@@ -30,19 +30,19 @@
}
-
+
protected void writeBody(DataOutputStream dos) throws IOException {
dos.writeShort(nameIndex);
}
-
+
public String toString() {
return "String: " + getValue();
}
/**
* Allows the constant pool entries to resolve their nested entries
- *
+ *
* @param pool
*/
protected void resolve(ClassConstantPool pool) {
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPUTF8.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPUTF8.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPUTF8.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPUTF8.java Tue Jan 29 07:53:23 2008
@@ -44,7 +44,7 @@
return false;
return true;
}
-
+
public int hashCode() {
final int PRIME = 31;
int result = 1;
@@ -76,7 +76,7 @@
public String underlyingString() {
return utf8;
}
-
+
public String comparisonString() {
// Should use either normalComparisonString or signatureComparisonString.
// If we get here, that might indicate an error.
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassConstantPool.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassConstantPool.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassConstantPool.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassConstantPool.java Tue Jan 29 07:53:23 2008
@@ -25,7 +25,7 @@
public class ClassConstantPool {
-
+
// These are the domains in sorted order.
public static int DOMAIN_UNDEFINED = 0;
public static int DOMAIN_INTEGER = 1;
@@ -57,7 +57,7 @@
// We don't want duplicates.
// Only add in constant pools, but resolve all types since they may
// introduce new constant pool entries
-// This is a handy way to see what's adding a ClassFileEntry - set a breakpoint on the print
+// This is a handy way to see what's adding a ClassFileEntry - set a breakpoint on the print
// if(entry instanceof CPFieldRef) {
// SegmentUtils.debug("AAH:" + ((CPFieldRef)entry).comparisonString());
// if (((CPUTF8)entry).underlyingString().matches("Code")) {
@@ -121,7 +121,7 @@
}
resolve();
}
-
+
public void resolve() {
resolved= true;
Iterator it = entries.iterator();
@@ -134,7 +134,7 @@
ClassFileEntry entry = (ClassFileEntry) it.next();
entry.resolve(this);
}
-
+
// Now that everything has been resolved, do one
// final sort of the class pool. This fixes up
// references, which are sorted by index in the
@@ -160,7 +160,7 @@
* classes when generating the set of relevant inner
* classes (ic_relevant())
* @return ArrayList collection of all classes.
- *
+ *
* NOTE: when this list is answered, the classes may not
* yet be resolved.
*/
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassFileEntry.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassFileEntry.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassFileEntry.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassFileEntry.java Tue Jan 29 07:53:23 2008
@@ -35,7 +35,7 @@
/**
* Allows the constant pool entries to resolve their nested entries
- *
+ *
* @param pool
*/
protected void resolve(ClassConstantPool pool) {
@@ -45,7 +45,7 @@
protected boolean isResolved() {
return resolved;
}
-
+
public abstract String toString();
public final void write(DataOutputStream dos) throws IOException {
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassPoolSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassPoolSet.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassPoolSet.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassPoolSet.java Tue Jan 29 07:53:23 2008
@@ -34,7 +34,7 @@
/* (non-Javadoc)
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
- public int compare(Object o1, Object o2) {
+ public int compare(Object o1, Object o2) {
if(o1.equals(o2)) {
return 0;
}
@@ -55,7 +55,7 @@
// with this comparator, it is an error.
ConstantPoolEntry cpe1 = (ConstantPoolEntry)o1;
ConstantPoolEntry cpe2 = (ConstantPoolEntry)o2;
-
+
// Domains must be the same, need to compare
// based on comparisonString.
String compare1 = cpe1.comparisonString();
@@ -73,7 +73,7 @@
if(classCompare != 0) {
return classCompare;
}
-
+
// Now that we've reached this point, we're
// comparing objects of the same class. Since
// they have the same class, we can make the
@@ -98,7 +98,7 @@
if(classCompare != 0) {
return classCompare;
}
-
+
// Now that we've reached this point, we're
// comparing objects of the same class. Since
// they have the same class, we can make the
@@ -132,13 +132,13 @@
comparators[ClassConstantPool.DOMAIN_FIELD] = new PoolComparator();
comparators[ClassConstantPool.DOMAIN_METHOD] = new PoolComparator();
comparators[ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ] = new NormalAsciizComparator();
-
+
for(int index=0; index < ClassConstantPool.NUM_DOMAINS; index++) {
sets[index] = new TreeSet(comparators[index]);
}
}
-
-
+
+
/**
* Answer the index of the first set which contains the entry
* passed in as the parameter.
@@ -153,7 +153,7 @@
}
return -1;
}
-
+
/**
* @param set
* @param testEntry
@@ -178,7 +178,7 @@
* that. If the parameter exists in a lower precedence
* domain, remove it from the lower domain and add it to
* the higher one.
- *
+ *
* @param entry ConstantPoolEntry to add
* @return ConstantPoolEntry from the domain where it's stored
*/
@@ -186,13 +186,13 @@
ConstantPoolEntry cpEntry = (ConstantPoolEntry)entry;
int entryDomain = cpEntry.getDomain();
int currentStoredDomain = findFirstSetContaining(cpEntry);
-
+
if(currentStoredDomain < 0) {
// Entry is not currently stored; just store it.
sets[entryDomain].add(cpEntry);
return cpEntry;
}
-
+
if(currentStoredDomain <= entryDomain) {
// Entry is either already in this place
// or in a higher-precedence (numerically lower)
@@ -200,7 +200,7 @@
// domain.
return getStoredEntry(currentStoredDomain, cpEntry);
}
-
+
// Entry is in a lower-precedence (numerically higher)
// domain. Need to remove it from the lower-precedence
// domain and add it to the higher precedence domain.
@@ -230,6 +230,6 @@
for(int index=start; index <= stop; index++) {
someElements.addAll(sets[index]);
}
- return someElements.iterator();
+ return someElements.iterator();
}
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CodeAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CodeAttribute.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CodeAttribute.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CodeAttribute.java Tue Jan 29 07:53:23 2008
@@ -84,7 +84,7 @@
byteCode.applyByteCodeTargetFixup(this);
}
// TODO: By the time I get here, the input stream
- // is somehow confused.
+ // is somehow confused.
}
protected int getLength() {
@@ -125,7 +125,7 @@
}
for (Iterator iter = exceptionTable.iterator(); iter.hasNext();) {
ExceptionTableEntry entry = (ExceptionTableEntry) iter.next();
- entry.resolve(pool);
+ entry.resolve(pool);
}
}
@@ -160,7 +160,7 @@
public void addAttribute(Attribute attribute) {
attributes.add(attribute);
}
-
+
public List attributes() {
return attributes;
}
@@ -173,7 +173,7 @@
public void renumber(List byteCodeOffsets) {
for (Iterator iter = exceptionTable.iterator(); iter.hasNext();) {
ExceptionTableEntry entry = (ExceptionTableEntry) iter.next();
- entry.renumber(byteCodeOffsets);
+ entry.renumber(byteCodeOffsets);
}
}
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantPoolEntry.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantPoolEntry.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantPoolEntry.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantPoolEntry.java Tue Jan 29 07:53:23 2008
@@ -20,7 +20,7 @@
import java.io.IOException;
/**
- *
+ *
*/
public abstract class ConstantPoolEntry extends ClassFileEntry {
public static final byte CP_Class = 7;
@@ -35,9 +35,9 @@
/*
* class MemberRef extends ConstantPoolEntry { private int index;
- *
+ *
* Class(String name) { super(CP_Class); index = pool.indexOf(name); }
- *
+ *
* void writeBody(DataOutputStream dos) throws IOException {
* dos.writeShort(index); } }
*/
@@ -76,11 +76,11 @@
public int getDomain() {
return domain;
}
-
+
public void setDomain(int newDomain) {
this.domain = newDomain;
}
-
+
public abstract int hashCode();
public void doWrite(DataOutputStream dos) throws IOException {
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantValueAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantValueAttribute.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantValueAttribute.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantValueAttribute.java Tue Jan 29 07:53:23 2008
@@ -41,7 +41,7 @@
}
}
-
+
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -58,7 +58,7 @@
return true;
}
-
+
protected int getLength() {
return 2;
}
@@ -67,7 +67,7 @@
return new ClassFileEntry[] { getAttributeName(), entry };
}
-
+
public int hashCode() {
final int PRIME = 31;
int result = super.hashCode();
@@ -85,7 +85,7 @@
return "Constant:" + entry;
}
-
+
protected void writeBody(DataOutputStream dos) throws IOException {
dos.writeShort(constantIndex);
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/EnclosingMethodAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/EnclosingMethodAttribute.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/EnclosingMethodAttribute.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/EnclosingMethodAttribute.java Tue Jan 29 07:53:23 2008
@@ -38,7 +38,7 @@
protected int getLength() {
return 4;
}
-
+
protected void resolve(ClassConstantPool pool) {
super.resolve(pool);
cpClass.resolve(pool);
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ExceptionTableEntry.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ExceptionTableEntry.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ExceptionTableEntry.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ExceptionTableEntry.java Tue Jan 29 07:53:23 2008
@@ -25,7 +25,7 @@
private int startPC;
private int endPC;
private int handlerPC;
- private CPClass catchType;
+ private CPClass catchType;
private int startPcRenumbered;
private int endPcRenumbered;
@@ -45,7 +45,7 @@
dos.writeShort(handlerPcRenumbered);
dos.writeShort(catchTypeIndex);
}
-
+
public void renumber(List byteCodeOffsets) {
startPcRenumbered = ((Integer)byteCodeOffsets.get(startPC)).intValue();
int endPcIndex = startPC + endPC;
@@ -53,7 +53,7 @@
int handlerPcIndex = endPcIndex + handlerPC;
handlerPcRenumbered = ((Integer)byteCodeOffsets.get(handlerPcIndex)).intValue();
}
-
+
public void resolve(ClassConstantPool pool) {
catchType.resolve(pool);
catchTypeIndex = pool.indexOf(catchType);
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ExceptionsAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ExceptionsAttribute.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ExceptionsAttribute.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ExceptionsAttribute.java Tue Jan 29 07:53:23 2008
@@ -44,7 +44,7 @@
this.exceptions = exceptions;
}
-
+
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -58,7 +58,7 @@
return true;
}
-
+
protected int getLength() {
return 2 + 2 * exceptions.length;
}
@@ -68,11 +68,11 @@
for (int i = 0; i < exceptions.length; i++) {
result[i] = exceptions[i];
}
- result[exceptions.length] = getAttributeName();
+ result[exceptions.length] = getAttributeName();
return result;
}
-
+
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
@@ -93,7 +93,7 @@
return "Exceptions:" + exceptions;
}
-
+
protected void writeBody(DataOutputStream dos) throws IOException {
dos.writeShort(exceptionIndexes.length);
for (int i = 0; i < exceptionIndexes.length; i++) {
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/InnerClassesAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/InnerClassesAttribute.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/InnerClassesAttribute.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/InnerClassesAttribute.java Tue Jan 29 07:53:23 2008
@@ -27,23 +27,23 @@
public class InnerClassesAttribute extends Attribute {
-
+
class InnerClassesEntry {
CPClass inner_class_info;
CPClass outer_class_info;
CPUTF8 inner_class_name;
-
+
int inner_class_info_index = -1;
int outer_class_info_index = -1;
int inner_name_index = -1;
int inner_class_access_flags = -1;
-
+
public InnerClassesEntry(IcTuple icTuple) {
this(icTuple.C, icTuple.C2, icTuple.N, icTuple.F);
}
-
+
public InnerClassesEntry(String innerString, String outerString, String nameString, int flags) {
-
+
}
public InnerClassesEntry(CPClass innerClass, CPClass outerClass, CPUTF8 innerName, int flags) {
this.inner_class_info = innerClass;
@@ -51,10 +51,10 @@
this.inner_class_name = innerName;
this.inner_class_access_flags = flags;
}
-
+
/**
* Determine the indices of the things in the receiver
- * which point to elements of the ClassConstantPool
+ * which point to elements of the ClassConstantPool
* @param pool ClassConstantPool which holds the
* CPClass and CPUTF8 objects.
*/
@@ -85,19 +85,19 @@
outer_class_info_index = 0;
}
}
-
+
public void write(DataOutputStream dos) throws IOException {
dos.writeShort(inner_class_info_index);
dos.writeShort(outer_class_info_index);
dos.writeShort(inner_name_index);
dos.writeShort(inner_class_access_flags);
}
-
+
}
-
+
private List innerClasses = new ArrayList();
private List nestedClassFileEntries = new ArrayList();
-
+
public InnerClassesAttribute(String name) {
super("InnerClasses"); //$NON-NLS-1$
nestedClassFileEntries.add(getAttributeName());
@@ -155,7 +155,7 @@
// Hack so I can see what's being written.
super.doWrite(dos);
}
-
+
protected void writeBody(DataOutputStream dos) throws IOException {
dos.writeShort(innerClasses.size());
Iterator it = innerClasses.iterator();
@@ -164,7 +164,7 @@
entry.write(dos);
}
}
-
+
public void addInnerClassesEntry(CPClass innerClass, CPClass outerClass, CPUTF8 innerName, int flags) {
if(innerClass != null) {
nestedClassFileEntries.add(innerClass);
@@ -177,7 +177,7 @@
}
addInnerClassesEntry(new InnerClassesEntry(innerClass, outerClass, innerName, flags));
}
-
+
private void addInnerClassesEntry(InnerClassesEntry innerClassesEntry) {
innerClasses.add(innerClassesEntry);
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LineNumberTableAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LineNumberTableAttribute.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LineNumberTableAttribute.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LineNumberTableAttribute.java Tue Jan 29 07:53:23 2008
@@ -24,7 +24,7 @@
private int line_number_table_length;
private int[] start_pcs;
private int[] line_numbers;
-
+
public LineNumberTableAttribute(int line_number_table_length, int[] start_pcs, int[] line_numbers) {
super("LineNumberTable");
this.line_number_table_length = line_number_table_length;
@@ -57,7 +57,7 @@
protected ClassFileEntry[] getNestedClassFileEntries() {
return new ClassFileEntry[] {getAttributeName()};
}
-
+
/* (non-Javadoc)
* @see org.apache.harmony.pack200.bytecode.Attribute#resolve(org.apache.harmony.pack200.bytecode.ClassConstantPool)
*/
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTableAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTableAttribute.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTableAttribute.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTableAttribute.java Tue Jan 29 07:53:23 2008
@@ -70,9 +70,9 @@
ClassFileEntry[] nestedEntryArray = new ClassFileEntry[nestedEntries
.size()];
nestedEntries.toArray(nestedEntryArray);
- return nestedEntryArray;
+ return nestedEntryArray;
}
-
+
protected void resolve(ClassConstantPool pool) {
super.resolve(pool);
name_indexes = new int[local_variable_table_length];
@@ -84,7 +84,7 @@
descriptor_indexes[i] = pool.indexOf(descriptors[i]);
}
}
-
+
public String toString() {
return "LocalVariableTable: " + + local_variable_table_length + " variables";
}
@@ -115,20 +115,20 @@
// First figure out the maximum size of the byteCodeOffsets array
int lastInstruction = ((Integer)byteCodeOffsets.get(byteCodeOffsets.size() - 1)).intValue();
int maxSize = lastInstruction + 1;
-
+
// Iterate through the lengths and update each in turn.
// This is done in place in the lengths array.
for(int index=0; index < lengths.length; index++) {
int start_pc = start_pcs[index];
int revisedLength = -1;
int encodedLength = lengths[index];
-
+
// First get the index of the start_pc in the byteCodeOffsets
int indexOfStartPC = unrenumbered_start_pcs[index];
// Given the index of the start_pc, we can now add
// the encodedLength to it to get the stop index.
int stopIndex = indexOfStartPC + encodedLength;
-
+
// Length can either be an index into the byte code offsets, or one beyond the
// end of the byte code offsets. Need to determine which this is.
if(stopIndex == byteCodeOffsets.size()) {
@@ -137,7 +137,7 @@
} else {
// We're indexed into the byte code array
int stopValue = ((Integer)byteCodeOffsets.get(stopIndex)).intValue();
- revisedLength = stopValue - start_pc;
+ revisedLength = stopValue - start_pc;
}
lengths[index] = revisedLength;
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTypeTableAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTypeTableAttribute.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTypeTableAttribute.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTypeTableAttribute.java Tue Jan 29 07:53:23 2008
@@ -69,7 +69,7 @@
signature_indexes[i] = pool.indexOf(signatures[i]);
}
}
-
+
public String toString() {
return "LocalVariableTypeTable: " + + local_variable_type_table_length + " varaibles";
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/NewAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/NewAttribute.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/NewAttribute.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/NewAttribute.java Tue Jan 29 07:53:23 2008
@@ -26,7 +26,7 @@
* A New (i.e. non-predefined) Class File attribute
*/
public class NewAttribute extends BCIRenumberedAttribute {
-
+
private List lengths = new ArrayList(); // List of Integers
private List body = new ArrayList();
private ClassConstantPool pool;
@@ -135,20 +135,20 @@
lengths.add(new Integer(length));
body.add(ref);
}
-
+
protected void resolve(ClassConstantPool pool) {
super.resolve(pool);
for (Iterator iter = body.iterator(); iter.hasNext();) {
- Object element = (Object) iter.next();
+ Object element = iter.next();
if(element instanceof ClassFileEntry) {
((ClassFileEntry)element).resolve(pool);
}
}
this.pool = pool;
}
-
+
private static class BCOffset extends BCValue {
-
+
private int offset;
private int index;
@@ -161,9 +161,9 @@
}
}
-
+
private static class BCIndex extends BCValue {
-
+
private int index;
public BCIndex(int index) {
@@ -172,14 +172,14 @@
}
private static class BCLength extends BCValue {
-
+
private int length;
public BCLength(int length) {
this.length = length;
}
}
-
+
// Bytecode-related value (either a bytecode index or a length)
private static abstract class BCValue {
@@ -195,12 +195,12 @@
// Don't need to return anything here as we've overridden renumber
return null;
}
-
+
public void renumber(List byteCodeOffsets) {
if(!renumbered) {
Object previous = null;
for (Iterator iter = body.iterator(); iter.hasNext();) {
- Object obj = (Object) iter.next();
+ Object obj = iter.next();
if(obj instanceof BCIndex) {
BCIndex bcIndex = (BCIndex) obj;
bcIndex.setActualValue(((Integer)byteCodeOffsets.get(bcIndex.index)).intValue());
@@ -209,14 +209,14 @@
if(previous instanceof BCIndex) {
int index = ((BCIndex)previous).index + bcOffset.offset;
bcOffset.setIndex(index);
- bcOffset.setActualValue(((Integer)byteCodeOffsets.get(index)).intValue());
+ bcOffset.setActualValue(((Integer)byteCodeOffsets.get(index)).intValue());
} else if(previous instanceof BCOffset) {
int index = ((BCOffset)previous).index + bcOffset.offset;
bcOffset.setIndex(index);
- bcOffset.setActualValue(((Integer)byteCodeOffsets.get(index)).intValue());
+ bcOffset.setActualValue(((Integer)byteCodeOffsets.get(index)).intValue());
} else {
// Not sure if this should be able to happen
- bcOffset.setActualValue(((Integer)byteCodeOffsets.get(bcOffset.offset)).intValue());
+ bcOffset.setActualValue(((Integer)byteCodeOffsets.get(bcOffset.offset)).intValue());
}
} else if (obj instanceof BCLength) {
// previous must be a BCIndex
@@ -224,7 +224,7 @@
BCIndex prevIndex = (BCIndex) previous;
int index = prevIndex.index + bcLength.length;
int actualLength = ((Integer)byteCodeOffsets.get(index)).intValue() - prevIndex.actualValue;
- bcLength.setActualValue(actualLength);
+ bcLength.setActualValue(actualLength);
}
previous = obj;
}
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/OperandManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/OperandManager.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/OperandManager.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/OperandManager.java Tue Jan 29 07:53:23 2008
@@ -27,7 +27,7 @@
* in super, this and new references.
*/
public class OperandManager {
-
+
int[] bcCaseCount;
int[] bcCaseValue;
int[] bcByte;
@@ -49,7 +49,7 @@
int[] bcSuperMethod;
int[] bcInitRef;
int[] wideByteCodes;
-
+
int bcCaseCountIndex = 0;
int bcCaseValueIndex = 0;
int bcByteIndex = 0;
@@ -71,13 +71,13 @@
int bcSuperMethodIndex = 0;
int bcInitRefIndex = 0;
int wideByteCodeIndex = 0;
-
+
Segment segment = null;
-
+
String currentClass = null;
String superClass = null;
String newClass = null;
-
+
public OperandManager(int[] bcCaseCount, int[] bcCaseValue, int[] bcByte, int[] bcShort, int[] bcLocal, int[] bcLabel, int[] bcIntRef, int[] bcFloatRef, int[] bcLongRef, int[] bcDoubleRef, int[] bcStringRef, int[] bcClassRef, int[] bcFieldRef, int[] bcMethodRef, int[] bcIMethodRef, int[] bcThisField, int[] bcSuperField, int[] bcThisMethod, int[] bcSuperMethod, int[] bcInitRef, int[] wideByteCodes) {
this.bcCaseCount = bcCaseCount;
this.bcCaseValue = bcCaseValue;
@@ -102,67 +102,67 @@
this.bcInitRef = bcInitRef;
this.wideByteCodes = wideByteCodes;
}
-
+
public int nextCaseCount() {
- return bcCaseCount[bcCaseCountIndex++];
+ return bcCaseCount[bcCaseCountIndex++];
}
-
+
public int nextCaseValues() {
- return bcCaseValue[bcCaseValueIndex++];
+ return bcCaseValue[bcCaseValueIndex++];
}
-
+
public int nextByte() {
- return bcByte[bcByteIndex++];
+ return bcByte[bcByteIndex++];
}
-
+
public int nextShort() {
- return bcShort[bcShortIndex++];
+ return bcShort[bcShortIndex++];
}
-
+
public int nextLocal() {
- return bcLocal[bcLocalIndex++];
+ return bcLocal[bcLocalIndex++];
}
-
+
public int nextLabel() {
- return bcLabel[bcLabelIndex++];
+ return bcLabel[bcLabelIndex++];
}
-
+
public int nextIntRef() {
- return bcIntRef[bcIntRefIndex++];
+ return bcIntRef[bcIntRefIndex++];
}
-
+
public int nextFloatRef() {
- return bcFloatRef[bcFloatRefIndex++];
+ return bcFloatRef[bcFloatRefIndex++];
}
-
+
public int nextLongRef() {
- return bcLongRef[bcLongRefIndex++];
+ return bcLongRef[bcLongRefIndex++];
}
-
+
public int nextDoubleRef() {
- return bcDoubleRef[bcDoubleRefIndex++];
+ return bcDoubleRef[bcDoubleRefIndex++];
}
-
+
public int nextStringRef() {
- return bcStringRef[bcStringRefIndex++];
+ return bcStringRef[bcStringRefIndex++];
}
-
+
public int nextClassRef() {
- return bcClassRef[bcClassRefIndex++];
+ return bcClassRef[bcClassRefIndex++];
}
-
+
public int nextFieldRef() {
- return bcFieldRef[bcFieldRefIndex++];
+ return bcFieldRef[bcFieldRefIndex++];
}
-
+
public int nextMethodRef() {
- return bcMethodRef[bcMethodRefIndex++];
+ return bcMethodRef[bcMethodRefIndex++];
}
-
+
public int nextIMethodRef() {
- return bcIMethodRef[bcIMethodRefIndex++];
+ return bcIMethodRef[bcIMethodRefIndex++];
}
-
+
public int nextThisFieldRef() {
return bcThisField[bcThisFieldIndex++];
}
@@ -186,18 +186,18 @@
public int nextWideByteCode() {
return wideByteCodes[wideByteCodeIndex++];
}
-
+
public void setSegment(Segment segment) {
this.segment = segment;
}
public Segment getSegment() {
return segment;
}
-
+
public SegmentConstantPool globalConstantPool() {
return segment.getConstantPool();
}
-
+
public void setCurrentClass(String string) {
currentClass = string;
}
@@ -207,7 +207,7 @@
public void setNewClass(String string) {
newClass = string;
}
-
+
public String getCurrentClass() {
if(null==currentClass) {
throw new Error("Current class not set yet");
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleParameterAnnotationsAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleParameterAnnotationsAttribute.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleParameterAnnotationsAttribute.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleParameterAnnotationsAttribute.java Tue Jan 29 07:53:23 2008
@@ -57,10 +57,10 @@
public String toString() {
return name + ": " + num_parameters + " parameter annotations";
}
-
+
public static class ParameterAnnotation {
-
+
private Annotation[] annotations;
private int num_annotations;
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SignatureAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SignatureAttribute.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SignatureAttribute.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SignatureAttribute.java Tue Jan 29 07:53:23 2008
@@ -20,7 +20,7 @@
import java.io.IOException;
public class SignatureAttribute extends Attribute {
-
+
private int signature_index;
private CPUTF8 signature;
@@ -41,7 +41,7 @@
signature.resolve(pool);
signature_index = pool.indexOf(signature);
}
-
+
/* (non-Javadoc)
* @see org.apache.harmony.pack200.bytecode.Attribute#writeBody(java.io.DataOutputStream)
*/
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ByteCodeForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ByteCodeForm.java?rev=616407&r1=616406&r2=616407&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ByteCodeForm.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ByteCodeForm.java Tue Jan 29 07:53:23 2008
@@ -56,9 +56,9 @@
protected static final int TYPE_SUPERINITMETHODREF=23;
protected static final int TYPE_NEWINITMETHODREF=24;
protected static final int TYPE_NEWCLASSREF=25;
-
+
protected static final boolean WIDENED = true;
-
+
protected static final Map byteCodes = new HashMap();
static {
ByteCodeForm[] byteCodeArray = new ByteCodeForm[256];
@@ -297,14 +297,14 @@
byteCodeArray[230] = new ThisInitMethodRefForm(230, "invokespecial_this_init", new int[] {183, -1, -1});
byteCodeArray[231] = new SuperInitMethodRefForm(231, "invokespecial_super_init", new int[] {183, -1, -1});
byteCodeArray[232] = new NewInitMethodRefForm(232, "invokespecial_new_init", new int[] {183, -1, -1});
- byteCodeArray[233] = new NarrowClassRefForm(233, "cldc", new int[] {18, -1});
+ byteCodeArray[233] = new NarrowClassRefForm(233, "cldc", new int[] {18, -1});
byteCodeArray[234] = new IntRefForm(234, "ildc", new int[] {18, -1});
byteCodeArray[235] = new FloatRefForm(235, "fldc", new int[] {18, -1});
byteCodeArray[236] = new NarrowClassRefForm(236, "cldc_w", new int[] {19, -1, -1}, WIDENED);
byteCodeArray[237] = new IntRefForm(237, "ildc_w", new int[] {19, -1, -1}, WIDENED);
byteCodeArray[238] = new FloatRefForm(238, "fldc_w", new int[] {19, -1, -1}, WIDENED);
byteCodeArray[239] = new DoubleForm(239, "dldc2_w", new int[] {20, -1, -1});
-
+
// Reserved bytecodes
byteCodeArray[254] = new NoArgumentForm(254, "impdep1");
byteCodeArray[255] = new NoArgumentForm(255, "impdep2");
@@ -312,7 +312,7 @@
// Bytecodes that aren't defined in the spec but are useful when
// unpacking (all must be >255)
// maybe wide versions of the others? etc.
-
+
// Put all the bytecodes in a HashMap so we can
// get them by either name or number
for (int i = 0; i < byteCodeArray.length; i++) {
@@ -323,13 +323,13 @@
}
}
}
-
+
private final int opcode;
private final String name;
private final int[] rewrite;
private int firstOperandIndex;
private int operandLength;
-
+
/**
* Answer a new instance of this class with the specified
* opcode and name. Assume no rewrite.
@@ -339,7 +339,7 @@
public ByteCodeForm(int opcode, String name) {
this(opcode, name, new int[]{opcode});
}
-
+
/**
* Answer a new instance of this class with the specified
* opcode, name, operandType and rewrite
@@ -358,7 +358,7 @@
protected void calculateOperandPosition() {
firstOperandIndex = -1;
operandLength = -1;
-
+
// Find the first negative number in the rewrite array
int iterationIndex = 0;
while (iterationIndex < rewrite.length) {
@@ -395,19 +395,19 @@
}
operandLength = difference + 1;
}
-
+
public static ByteCodeForm get(int opcode) {
return (ByteCodeForm)byteCodes.get(new Integer(opcode));
}
-
+
public static ByteCodeForm get(String name) {
return (ByteCodeForm)byteCodes.get(name);
}
-
+
public String toString() {
return this.getClass().getName() + "(" + getName() + ":" + getOperandType() + ")";
}
-
+
public int getOpcode() {
return opcode;
}
@@ -419,21 +419,21 @@
public int getOperandType() {
return -1;
}
-
+
public int[] getRewrite() {
return rewrite;
}
-
+
public int[] getRewriteCopy() {
int[] result = new int[rewrite.length];
System.arraycopy(rewrite, 0, result, 0, rewrite.length);
return result;
}
-
+
public int firstOperandIndex() {
return firstOperandIndex;
}
-
+
public int operandLength() {
return operandLength;
}
@@ -441,7 +441,7 @@
public boolean hasNoOperand() {
return false;
}
-
+
public boolean hasByteOperand() {
return false;
}
@@ -537,18 +537,18 @@
public boolean hasNewInitMethodRefOperand() {
return false;
}
-
+
public boolean hasInitMethodRefOperand() {
return false;
}
-
+
/**
* This method will answer true if the receiver is
* a multi-bytecode instruction (such as
* aload0_putfield_super); otherwise, it will answer
* false.
- *
+ *
* @return boolean true if multibytecode, false otherwise
*/
public boolean hasMultipleByteCodes() {
@@ -564,12 +564,12 @@
}
return false;
}
-
+
/**
* When passed a byteCode, an OperandTable and a
* SegmentConstantPool, this method will set the
* rewrite of the byteCode appropriately.
- *
+ *
* @param byteCode ByteCode to be updated (!)
* @param operandManager OperandTable from which to draw info
* @param codeLength Length of bytes (excluding this bytecode)
@@ -579,7 +579,7 @@
*/
public void setByteCodeOperands(ByteCode byteCode,
OperandManager operandManager, int codeLength) {
- throw new Error("My subclass should have implemented this");
+ throw new Error("My subclass should have implemented this");
}
/**