You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by to...@apache.org on 2008/03/04 09:02:45 UTC
svn commit: r633384 [14/15] - in /harmony/enhanced/classlib/branches/java6:
depends/build/platform/ depends/files/ depends/files/bcprov/ doc/
doc/classlib/ make/ make/linux.ia64/ make/linux.ppc32/ make/linux.ppc64/
make/linux.x86.libstdc++6/ make/linux...
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentConstantPool.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentConstantPool.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentConstantPool.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentConstantPool.java Tue Mar 4 00:02:13 2008
@@ -18,16 +18,9 @@
import java.util.ArrayList;
-import org.apache.harmony.pack200.bytecode.CPClass;
-import org.apache.harmony.pack200.bytecode.CPDouble;
import org.apache.harmony.pack200.bytecode.CPFieldRef;
-import org.apache.harmony.pack200.bytecode.CPFloat;
-import org.apache.harmony.pack200.bytecode.CPInteger;
import org.apache.harmony.pack200.bytecode.CPInterfaceMethodRef;
-import org.apache.harmony.pack200.bytecode.CPLong;
import org.apache.harmony.pack200.bytecode.CPMethodRef;
-import org.apache.harmony.pack200.bytecode.CPString;
-import org.apache.harmony.pack200.bytecode.CPUTF8;
import org.apache.harmony.pack200.bytecode.ClassConstantPool;
import org.apache.harmony.pack200.bytecode.ConstantPoolEntry;
@@ -60,6 +53,7 @@
public static final int CP_METHOD = 11;
public static final int CP_IMETHOD = 12;
+ // TODO: All CP***??
public Object getValue(int cp, long value) throws Pack200Exception {
int index = (int) value;
if (index == -1) {
@@ -77,7 +71,7 @@
} else if (cp == CP_DOUBLE) {
return new Double(bands.getCpDouble()[index]);
} else if (cp == CP_STRING) {
- return bands.getCpString()[index];
+ return bands.cpStringValue(bands.getCpString()[index]);
} else if (cp == CP_CLASS) {
return bands.getCpClass()[index];
} else if (cp == SIGNATURE) {
@@ -178,8 +172,8 @@
* String [position 2, 1st instance of String]
* Object [position 3, 1st instance of Object]
* Object [position 4, 2nd instance of Object]
- * then classSpecificPoolEntryIndex(..., "Object", 2, false) will
- * answer 4. classSpecificPoolEntryIndex(..., "String", 0, false)
+ * then matchSpecificPoolEntryIndex(..., "Object", 2, false) will
+ * answer 4. matchSpecificPoolEntryIndex(..., "String", 0, false)
* will answer 1.
*
* @param nameArray Array of Strings against which the compareString is tested
@@ -220,9 +214,6 @@
}
// We didn't return in the for loop, so the desiredMatch
// with desiredIndex must not exist in the array.
- if(secondaryCompareRegex.equals("^<init>.*")) {
- SegmentUtils.debug("self halt");
- }
return -1;
}
@@ -234,19 +225,19 @@
} else if (index < 0) {
throw new Pack200Exception("Cannot have a negative range");
} else if (cp == UTF_8) {
- return new CPUTF8(bands.getCpUTF8()[index], ClassConstantPool.DOMAIN_NORMALASCIIZ);
+ return bands.cpUTF8Value(bands.getCpUTF8()[index], ClassConstantPool.DOMAIN_NORMALASCIIZ);
} else if (cp == CP_INT) {
- return new CPInteger(new Integer(bands.getCpInt()[index]));
+ return bands.cpIntegerValue(new Integer(bands.getCpInt()[index]));
} else if (cp == CP_FLOAT) {
- return new CPFloat(new Float(bands.getCpFloat()[index]));
+ return bands.cpFloatValue(new Float(bands.getCpFloat()[index]));
} else if (cp == CP_LONG) {
- return new CPLong(new Long(bands.getCpLong()[index]));
+ return bands.cpLongValue(new Long(bands.getCpLong()[index]));
} else if (cp == CP_DOUBLE) {
- return new CPDouble(new Double(bands.getCpDouble()[index]));
+ return bands.cpDoubleValue(new Double(bands.getCpDouble()[index]));
} else if (cp == CP_STRING) {
- return new CPString(bands.getCpString()[index]);
+ return bands.cpStringValue(bands.getCpString()[index]);
} else if (cp == CP_CLASS) {
- return new CPClass(bands.getCpClass()[index]);
+ return bands.cpClassValue(bands.getCpClass()[index]);
} else if (cp == SIGNATURE) {
throw new Error("I don't know what to do with signatures yet");
// return null /* new CPSignature(bands.getCpSignature()[index]) */;
@@ -254,11 +245,17 @@
throw new Error("I don't know what to do with descriptors yet");
// return null /* new CPDescriptor(bands.getCpDescriptor()[index]) */;
} else if (cp == CP_FIELD) {
- return new CPFieldRef(bands.getCpFieldClass()[index], bands.getCpFieldDescriptor()[index]);
+ return new CPFieldRef(bands
+ .cpClassValue(bands.getCpFieldClass()[index]), bands
+ .cpNameAndTypeValue(bands.getCpFieldDescriptor()[index]));
} else if (cp == CP_METHOD) {
- return new CPMethodRef(bands.getCpMethodClass()[index], bands.getCpMethodDescriptor()[index]);
+ return new CPMethodRef(bands
+ .cpClassValue(bands.getCpMethodClass()[index]), bands
+ .cpNameAndTypeValue(bands.getCpMethodDescriptor()[index]));
} else if (cp == CP_IMETHOD) {
- return new CPInterfaceMethodRef(bands.getCpIMethodClass()[index], bands.getCpIMethodDescriptor()[index]);
+ return new CPInterfaceMethodRef(bands.cpClassValue(bands
+ .getCpIMethodClass()[index]), bands.cpNameAndTypeValue(bands
+ .getCpIMethodDescriptor()[index]));
} else {
// etc
throw new Error("Get value incomplete");
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentUtils.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentUtils.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentUtils.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentUtils.java Tue Mar 4 00:02:13 2008
@@ -121,37 +121,22 @@
}
/**
- * Given a String classX (the name of a class) and the
- * collection of inner class tuples ic_all, answer
- * 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
+ * Answer the index of the first character <= '$'
+ * in the parameter. This is used instead of indexOf('$')
+ * because inner classes may be separated by any character
+ * <= '$' (in other words, Foo#Bar is as valid as Foo$Bar).
+ * If no $ character is found, answer -1.
+ * @param string String to search for $
+ * @return first index of $ character, or -1 if not found
*/
- 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
- // specified and it's the correct one, the
- // 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;
+ public static int indexOfFirstDollar(String string) {
+ for(int index=0; index<string.length(); index++) {
+ if(string.charAt(index) <= '$') {
+ return index;
+ }
}
-
- // Now we know that tuple.C is null, so it might be
- // relevant. Find out.
- return false;
+ return -1;
}
-
private SegmentUtils() {
// Intended to be a helper class
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/AnnotationDefaultAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/AnnotationDefaultAttribute.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/AnnotationDefaultAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/AnnotationDefaultAttribute.java Tue Mar 4 00:02:13 2008
@@ -26,8 +26,10 @@
private ElementValue element_value;
+ private static final CPUTF8 attributeName = new CPUTF8("AnnotationDefault", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ);
+
public AnnotationDefaultAttribute(ElementValue element_value) {
- super("AnnotationDefault");
+ super(attributeName);
this.element_value = element_value;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/AnnotationsAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/AnnotationsAttribute.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/AnnotationsAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/AnnotationsAttribute.java Tue Mar 4 00:02:13 2008
@@ -154,7 +154,7 @@
}
}
- public AnnotationsAttribute(String attributeName) {
+ public AnnotationsAttribute(CPUTF8 attributeName) {
super(attributeName);
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/Attribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/Attribute.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/Attribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/Attribute.java Tue Mar 4 00:02:13 2008
@@ -24,8 +24,8 @@
private int attributeNameIndex;
- public Attribute(String attributeName) {
- this.attributeName = new CPUTF8(attributeName, ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ);
+ public Attribute(CPUTF8 attributeName) {
+ this.attributeName = attributeName;
}
protected void doWrite(DataOutputStream dos) throws IOException {
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/BCIRenumberedAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/BCIRenumberedAttribute.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/BCIRenumberedAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/BCIRenumberedAttribute.java Tue Mar 4 00:02:13 2008
@@ -20,8 +20,6 @@
import java.io.IOException;
import java.util.List;
-import org.apache.harmony.pack200.SegmentUtils;
-
public abstract class BCIRenumberedAttribute extends Attribute {
protected boolean renumbered = false;
@@ -33,7 +31,7 @@
return true;
}
- public BCIRenumberedAttribute(String attributeName) {
+ public BCIRenumberedAttribute(CPUTF8 attributeName) {
super(attributeName);
}
@@ -54,9 +52,7 @@
*/
public void renumber(List byteCodeOffsets) {
if(renumbered) {
- SegmentUtils.debug("Trying to renumber something renumbered");
- return;
-// throw new Error("Trying to renumber a line number table that has already been renumbered");
+ throw new Error("Trying to renumber a line number table that has already been renumbered");
}
renumbered = true;
int[] startPCs = getStartPCs();
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ByteCode.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ByteCode.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ByteCode.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ByteCode.java Tue Mar 4 00:02:13 2008
@@ -135,7 +135,8 @@
case 4:
// TODO: need to handle wides?
- SegmentUtils.debug("Need to handle wides");
+ SegmentUtils.debug("Need to handle wides");
+ throw new Error("Instruction argument not handled");
// figure out and if so, handle and put a break here.
// break;
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPClass.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPClass.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPClass.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPClass.java Tue Mar 4 00:02:13 2008
@@ -26,16 +26,15 @@
public String name;
private CPUTF8 utf8;
-
- public CPClass(String name) {
+
+ public CPClass(CPUTF8 name) {
super(ConstantPoolEntry.CP_Class);
- this.name = name;
+ this.name = name.underlyingString();
this.domain = ClassConstantPool.DOMAIN_CLASSREF;
- this.utf8 = new CPUTF8(name, ClassConstantPool.DOMAIN_NORMALASCIIZ);
+ this.utf8 = name;
}
-
- public boolean equals(Object obj) {
+ public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPDouble.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPDouble.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPDouble.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPDouble.java Tue Mar 4 00:02:13 2008
@@ -20,16 +20,15 @@
import java.io.IOException;
public class CPDouble extends CPConstantNumber {
- public CPDouble(java.lang.Double value) {
+
+ public CPDouble(Double value) {
super(ConstantPoolEntry.CP_Double,value);
this.domain = ClassConstantPool.DOMAIN_DOUBLE;
}
-
- protected void writeBody(DataOutputStream dos) throws IOException {
+ protected void writeBody(DataOutputStream dos) throws IOException {
dos.writeDouble(getNumber().doubleValue());
}
-
public String toString() {
return "Double: " + getValue();
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPField.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPField.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPField.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPField.java Tue Mar 4 00:02:13 2008
@@ -20,8 +20,8 @@
public class CPField extends CPMember {
- public CPField(String descriptor, long flags, List attributes) {
- super(descriptor, flags, attributes);
+ public CPField(CPUTF8 name, CPUTF8 descriptor, long flags, List attributes) {
+ super(name, descriptor, flags, attributes);
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPFieldRef.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPFieldRef.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPFieldRef.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPFieldRef.java Tue Mar 4 00:02:13 2008
@@ -19,30 +19,24 @@
import java.io.DataOutputStream;
import java.io.IOException;
-
public class CPFieldRef extends ConstantPoolEntry {
CPClass className;
transient int classNameIndex;
-
-
private CPNameAndType nameAndType;
transient int nameAndTypeIndex;
- public CPFieldRef(String className, String descriptor) {
+
+ public CPFieldRef(CPClass className, CPNameAndType descriptor) {
super(ConstantPoolEntry.CP_Fieldref);
this.domain = ClassConstantPool.DOMAIN_FIELD;
- this.className = new CPClass(className);
- this.nameAndType = new CPNameAndType(descriptor);
+ this.className = className;
+ this.nameAndType = descriptor;
}
-
-
protected ClassFileEntry[] getNestedClassFileEntries() {
return new ClassFileEntry[] {className, nameAndType};
}
-
-
protected void resolve(ClassConstantPool pool) {
super.resolve(pool);
nameAndTypeIndex = pool.indexOf(nameAndType);
@@ -54,7 +48,6 @@
dos.writeShort(nameAndTypeIndex);
}
-
public String toString() {
return "FieldRef: " + className + "#" + nameAndType;
}
@@ -71,8 +64,6 @@
return result;
}
-
-
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -94,4 +85,4 @@
return true;
}
-}
+}
\ No newline at end of file
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPFloat.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPFloat.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPFloat.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPFloat.java Tue Mar 4 00:02:13 2008
@@ -20,16 +20,15 @@
import java.io.IOException;
public class CPFloat extends CPConstantNumber {
- public CPFloat(java.lang.Float value) {
+
+ public CPFloat(Float value) {
super(ConstantPoolEntry.CP_Float,value);
this.domain = ClassConstantPool.DOMAIN_FLOAT;
}
-
- protected void writeBody(DataOutputStream dos) throws IOException {
+ protected void writeBody(DataOutputStream dos) throws IOException {
dos.writeFloat(getNumber().floatValue());
}
-
public String toString() {
return "Float: " + getValue();
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPInteger.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPInteger.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPInteger.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPInteger.java Tue Mar 4 00:02:13 2008
@@ -21,13 +21,12 @@
public class CPInteger extends CPConstantNumber {
- public CPInteger(java.lang.Integer value) {
+ public CPInteger(Integer value) {
super(ConstantPoolEntry.CP_Integer,value);
this.domain = ClassConstantPool.DOMAIN_INTEGER;
}
-
- protected void writeBody(DataOutputStream dos) throws IOException {
+ protected void writeBody(DataOutputStream dos) throws IOException {
dos.writeInt(getNumber().intValue());
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPInterfaceMethodRef.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPInterfaceMethodRef.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPInterfaceMethodRef.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPInterfaceMethodRef.java Tue Mar 4 00:02:13 2008
@@ -18,7 +18,7 @@
public class CPInterfaceMethodRef extends CPRef {
- public CPInterfaceMethodRef(String className, String descriptor) {
+ public CPInterfaceMethodRef(CPClass className, CPNameAndType descriptor) {
super(ConstantPoolEntry.CP_InterfaceMethodref, className, descriptor);
this.domain = ClassConstantPool.DOMAIN_METHOD;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPLong.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPLong.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPLong.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPLong.java Tue Mar 4 00:02:13 2008
@@ -21,13 +21,12 @@
public class CPLong extends CPConstantNumber {
- public CPLong(java.lang.Long value) {
+ public CPLong(Long value) {
super(ConstantPoolEntry.CP_Long,value);
this.domain = ClassConstantPool.DOMAIN_LONG;
}
-
- protected void writeBody(DataOutputStream dos) throws IOException {
+ protected void writeBody(DataOutputStream dos) throws IOException {
dos.writeLong(getNumber().longValue());
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPMember.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPMember.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPMember.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPMember.java Tue Mar 4 00:02:13 2008
@@ -22,30 +22,22 @@
import java.util.Iterator;
import java.util.List;
-
public class CPMember extends ClassFileEntry {
List attributes;
-
-
short flags;
-
CPUTF8 name;
transient int nameIndex;
-
-
private CPUTF8 descriptor;
transient int descriptorIndex;
- public CPMember(String descriptor, long flags, List attributes) {
- int colon = descriptor.indexOf(':');
- this.name = new CPUTF8(descriptor.substring(0,colon), ClassConstantPool.DOMAIN_NORMALASCIIZ);
- this.descriptor = new CPUTF8(descriptor.substring(colon+1), ClassConstantPool.DOMAIN_SIGNATUREASCIIZ);
- this.flags = (short) flags;
+
+ public CPMember(CPUTF8 name, CPUTF8 descriptor, long flags, List attributes) {
+ this.name = name;
+ this.descriptor = descriptor;
+ this.flags = (short) flags;
this.attributes = (attributes == null ? new ArrayList() : attributes);
}
-
-
protected ClassFileEntry[] getNestedClassFileEntries() {
int attributeCount = attributes.size();
ClassFileEntry[] entries = new ClassFileEntry[attributeCount+2];
@@ -57,8 +49,6 @@
return entries;
}
-
-
protected void resolve(ClassConstantPool pool) {
super.resolve(pool);
nameIndex = pool.indexOf(name);
@@ -69,12 +59,10 @@
}
}
-
public String toString() {
return "Field: " + name + "(" + descriptor + ")";
}
-
public int hashCode() {
final int PRIME = 31;
int result = 1;
@@ -85,8 +73,6 @@
return result;
}
-
-
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -115,8 +101,6 @@
return true;
}
-
-
protected void doWrite(DataOutputStream dos) throws IOException {
dos.writeShort(flags);
dos.writeShort(nameIndex);
@@ -127,7 +111,6 @@
Attribute attribute = (Attribute) attributes.get(i);
attribute.doWrite(dos);
}
-
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPMethod.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPMethod.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPMethod.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPMethod.java Tue Mar 4 00:02:13 2008
@@ -20,9 +20,9 @@
public class CPMethod extends CPMember {
- public CPMethod(String descriptor, long flags, List attributes) {
+ public CPMethod(CPUTF8 name, CPUTF8 descriptor, long flags, List attributes) {
// TODO Check that we only pass these on, or remap
- super(descriptor, 0x7FFF & flags, attributes);
+ super(name, descriptor, 0x7FFF & flags, attributes);
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPMethodRef.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPMethodRef.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPMethodRef.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPMethodRef.java Tue Mar 4 00:02:13 2008
@@ -18,18 +18,13 @@
public class CPMethodRef extends CPRef {
- protected CPClass className = null;
- protected CPNameAndType descriptor = null;
-
- public CPMethodRef(String className, String descriptor) {
+ public CPMethodRef(CPClass className, CPNameAndType descriptor) {
super(ConstantPoolEntry.CP_Methodref, className, descriptor);
- this.className = new CPClass(className);
- this.descriptor = new CPNameAndType(descriptor);
this.domain = ClassConstantPool.DOMAIN_METHOD;
}
protected ClassFileEntry[] getNestedClassFileEntries() {
- return new ClassFileEntry[] { className, descriptor };
+ return new ClassFileEntry[] { className, nameAndType };
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPNameAndType.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPNameAndType.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPNameAndType.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPNameAndType.java Tue Mar 4 00:02:13 2008
@@ -21,7 +21,6 @@
import org.apache.harmony.pack200.SegmentUtils;
-
public class CPNameAndType extends ConstantPoolEntry {
CPUTF8 descriptor;
@@ -32,42 +31,16 @@
transient int nameIndex;
- public CPNameAndType(String descriptor) {
+ public CPNameAndType(CPUTF8 name, CPUTF8 descriptor, int domain) {
super(ConstantPoolEntry.CP_NameAndType);
- int descriptorDomain = ClassConstantPool.DOMAIN_UNDEFINED;
- int colon = descriptor.indexOf(':');
- String nameString = descriptor.substring(0,colon);
- String descriptorString = descriptor.substring(colon+1);
- // For some reason, descriptors which have just plain
- // native types are stored in DOMAIN_NORMALASCIIZ rather
- // than in DOMAIN_SIGNATUREASCIIZ. This might indicate
- // that DOMAIN_SIGNATUREASCIIZ is poorly named.
- boolean nativeDescriptor = true;
- for(int index=0; index < descriptorString.length(); index++) {
- char currentChar = descriptorString.charAt(index);
- if(Character.isLetter(currentChar)) {
- if(currentChar == 'L') {
- nativeDescriptor = false;
- }
- break;
- }
- }
- this.domain = ClassConstantPool.DOMAIN_NAMEANDTYPE;
- this.name = new CPUTF8(nameString, ClassConstantPool.DOMAIN_NORMALASCIIZ);
- if( nativeDescriptor ) {
- // Native signatures are stored in DOMAIN_NORMALASCIIZ, not
- // DOMAIN_SIGNATUREASCIIZ for some reason.
- descriptorDomain = ClassConstantPool.DOMAIN_NORMALASCIIZ;
- } else {
- descriptorDomain = ClassConstantPool.DOMAIN_SIGNATUREASCIIZ;
- }
- this.descriptor = new CPUTF8(descriptorString, descriptorDomain);
+ this.name = name;
+ this.descriptor = descriptor;
+ this.domain = domain;
}
protected ClassFileEntry[] getNestedClassFileEntries() {
return new ClassFileEntry[] { name, descriptor };
}
-
protected void resolve(ClassConstantPool pool) {
super.resolve(pool);
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPRef.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPRef.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPRef.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPRef.java Tue Mar 4 00:02:13 2008
@@ -24,13 +24,13 @@
CPClass className;
transient int classNameIndex;
- protected final CPNameAndType nameAndType;
+ protected CPNameAndType nameAndType;
transient int nameAndTypeIndex;
- public CPRef(byte type, String className, String descriptor) {
+ public CPRef(byte type, CPClass className, CPNameAndType descriptor) {
super(type);
- this.className = new CPClass(className);
- this.nameAndType = new CPNameAndType(descriptor);
+ this.className = className;
+ this.nameAndType = descriptor;
}
public boolean equals(Object obj) {
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPString.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPString.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPString.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPString.java Tue Mar 4 00:02:13 2008
@@ -20,18 +20,17 @@
import java.io.IOException;
public class CPString extends CPConstant {
- private transient int nameIndex;
+
+ private transient int nameIndex;
private CPUTF8 name;
- public CPString(java.lang.String value) {
- super(ConstantPoolEntry.CP_String,value);
+ public CPString(CPUTF8 value) {
+ super(ConstantPoolEntry.CP_String, value);
this.domain = ClassConstantPool.DOMAIN_STRING;
- this.name = new CPUTF8((String) getValue(), ClassConstantPool.DOMAIN_NORMALASCIIZ);
-
+ this.name = value;
}
-
- protected void writeBody(DataOutputStream dos) throws IOException {
+ protected void writeBody(DataOutputStream dos) throws IOException {
dos.writeShort(nameIndex);
}
@@ -55,6 +54,6 @@
}
public String comparisonString() {
- return (String)getValue();
+ return ((CPUTF8)getValue()).underlyingString();
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPUTF8.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPUTF8.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPUTF8.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPUTF8.java Tue Mar 4 00:02:13 2008
@@ -21,12 +21,16 @@
import java.io.UnsupportedEncodingException;
public class CPUTF8 extends ConstantPoolEntry {
- private String utf8;
- public CPUTF8(String utf8, int domain) {
+ private String utf8;
+
+ public CPUTF8(String utf8, int domain) {
super(ConstantPoolEntry.CP_UTF8);
this.utf8 = utf8;
this.domain = domain;
+ if(domain == ClassConstantPool.DOMAIN_UNDEFINED) {
+ throw new RuntimeException();
+ }
}
public boolean equals(Object obj) {
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassConstantPool.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassConstantPool.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassConstantPool.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassConstantPool.java Tue Mar 4 00:02:13 2008
@@ -21,7 +21,6 @@
import java.util.List;
import org.apache.harmony.pack200.Segment;
-import org.apache.harmony.pack200.SegmentUtils;
public class ClassConstantPool {
@@ -68,7 +67,6 @@
classPoolSet.add(entry);
if (!entries.contains(entry)) {
entries.add(entry);
- // TODO This will be a bugger when they're sorted.
if (entry instanceof CPLong ||entry instanceof CPDouble)
entries.add(entry); //these get 2 slots because of their size
}
@@ -105,11 +103,7 @@
}
public void resolve(Segment segment) {
- SegmentUtils.debug("\n\nResolving (Segment.resolve(Segment)");
- // TODO: Be careful here, you're obliterating the original entries.
- // In an ideal world, you wouldn't actually add to it unless you're
- // sure.
- entries = new ArrayList();
+ entries = new ArrayList();
Iterator sortedIterator = classPoolSet.iterator();
while(sortedIterator.hasNext()) {
ConstantPoolEntry entry = (ConstantPoolEntry)sortedIterator.next();
@@ -152,6 +146,21 @@
if (entry instanceof CPLong ||entry instanceof CPDouble)
entries.add(entry); //these get 2 slots because of their size
}
+
+ // Now that the indices have been re-sorted, need
+ // to re-resolve to update references. This should
+ // not add any new entries this time through.
+ it = entries.iterator();
+ while(it.hasNext()) {
+ ClassFileEntry entry = (ClassFileEntry)it.next();
+ entry.resolve(this);
+ }
+ // Also need to re-resolve the others.
+ it = others.iterator();
+ while(it.hasNext()) {
+ ClassFileEntry entry = (ClassFileEntry)it.next();
+ entry.resolve(this);
+ }
}
/**
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CodeAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CodeAttribute.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CodeAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CodeAttribute.java Tue Mar 4 00:02:13 2008
@@ -33,10 +33,11 @@
public List exceptionTable; // of ExceptionTableEntry
public int maxLocals;
public int maxStack;
+ private static final CPUTF8 attributeName = new CPUTF8("Code", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ);
public CodeAttribute(int maxStack, int maxLocals, byte codePacked[],
Segment segment, OperandManager operandManager, List exceptionTable) {
- super("Code"); //$NON-NLS-1$
+ super(attributeName); //$NON-NLS-1$
this.maxLocals = maxLocals;
this.maxStack = maxStack;
this.codeLength = 0;
@@ -83,8 +84,6 @@
ByteCode byteCode = (ByteCode)byteCodes.get(i);
byteCode.applyByteCodeTargetFixup(this);
}
- // TODO: By the time I get here, the input stream
- // is somehow confused.
}
protected int getLength() {
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantValueAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantValueAttribute.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantValueAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantValueAttribute.java Tue Mar 4 00:02:13 2008
@@ -24,23 +24,16 @@
private ClassFileEntry entry;
- public ConstantValueAttribute(Object value) {
- super("ConstantValue"); //$NON-NLS-1$
- if (value instanceof java.lang.Integer) {
- this.entry = new CPInteger((Integer) value);
- } else if (value instanceof java.lang.Long) {
- this.entry = new CPLong((Long) value);
- } else if (value instanceof java.lang.Float) {
- this.entry = new CPFloat((Float) value);
- } else if (value instanceof java.lang.Double) {
- this.entry = new CPDouble((Double) value);
- } else if (value instanceof java.lang.String) {
- this.entry = new CPString((String) value);
- } else {
- throw new Error("Oops, I've not done it again");
- }
- }
+ private static final CPUTF8 attributeName = new CPUTF8(
+ "ConstantValue", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ); //$NON-NLS-1$
+ public ConstantValueAttribute(ClassFileEntry entry) {
+ super(attributeName);
+ if(entry == null) {
+ throw new NullPointerException();
+ }
+ this.entry = entry;
+ }
public boolean equals(Object obj) {
if (this == obj)
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/EnclosingMethodAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/EnclosingMethodAttribute.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/EnclosingMethodAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/EnclosingMethodAttribute.java Tue Mar 4 00:02:13 2008
@@ -25,9 +25,11 @@
private int method_index;
private CPClass cpClass;
private CPNameAndType method;
+ private static final CPUTF8 attributeName = new CPUTF8(
+ "EnclosingMethod", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ); //$NON-NLS-1$
public EnclosingMethodAttribute(CPClass cpClass, CPNameAndType method) {
- super("EnclosingMethod");
+ super(attributeName);
this.cpClass = cpClass;
this.method = method;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ExceptionsAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ExceptionsAttribute.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ExceptionsAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ExceptionsAttribute.java Tue Mar 4 00:02:13 2008
@@ -21,6 +21,9 @@
import java.util.Arrays;
public class ExceptionsAttribute extends Attribute {
+
+ private static final CPUTF8 attributeName = new CPUTF8(
+ "Exceptions", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ); //$NON-NLS-1$
private static int hashCode(Object[] array) {
final int prime = 31;
@@ -34,17 +37,15 @@
return result;
}
-
private transient int[] exceptionIndexes;
private CPClass[] exceptions;
public ExceptionsAttribute(CPClass[] exceptions) {
- super("Exceptions"); //$NON-NLS-1$
+ super(attributeName);
this.exceptions = exceptions;
}
-
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -58,7 +59,6 @@
return true;
}
-
protected int getLength() {
return 2 + 2 * exceptions.length;
}
@@ -72,7 +72,6 @@
return result;
}
-
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
@@ -92,7 +91,6 @@
public String toString() {
return "Exceptions:" + exceptions;
}
-
protected void writeBody(DataOutputStream dos) throws IOException {
dos.writeShort(exceptionIndexes.length);
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/InnerClassesAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/InnerClassesAttribute.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/InnerClassesAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/InnerClassesAttribute.java Tue Mar 4 00:02:13 2008
@@ -23,10 +23,13 @@
import java.util.List;
import org.apache.harmony.pack200.IcTuple;
-import org.apache.harmony.pack200.SegmentUtils;
public class InnerClassesAttribute extends Attribute {
+
+ private static final CPUTF8 attributeName = new CPUTF8(
+ "InnerClasses", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ); //$NON-NLS-1$
+
class InnerClassesEntry {
CPClass inner_class_info;
@@ -59,11 +62,6 @@
* CPClass and CPUTF8 objects.
*/
public void resolve(ClassConstantPool pool) {
- SegmentUtils.debug("----");
- SegmentUtils.debug("inner_class_info: " + inner_class_info);
- SegmentUtils.debug("inner_class_name: " + inner_class_name);
- SegmentUtils.debug("outer_class_info: " + outer_class_info);
-
if(inner_class_info != null) {
inner_class_info.resolve(pool);
inner_class_info_index = pool.indexOf(inner_class_info);
@@ -99,7 +97,7 @@
private List nestedClassFileEntries = new ArrayList();
public InnerClassesAttribute(String name) {
- super("InnerClasses"); //$NON-NLS-1$
+ super(attributeName);
nestedClassFileEntries.add(getAttributeName());
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LineNumberTableAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LineNumberTableAttribute.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LineNumberTableAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LineNumberTableAttribute.java Tue Mar 4 00:02:13 2008
@@ -24,9 +24,12 @@
private int line_number_table_length;
private int[] start_pcs;
private int[] line_numbers;
+ private static final CPUTF8 attributeName = new CPUTF8(
+ "LineNumberTable", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ); //$NON-NLS-1$
+
public LineNumberTableAttribute(int line_number_table_length, int[] start_pcs, int[] line_numbers) {
- super("LineNumberTable");
+ super(attributeName);
this.line_number_table_length = line_number_table_length;
this.start_pcs = start_pcs;
this.line_numbers = line_numbers;
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTableAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTableAttribute.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTableAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTableAttribute.java Tue Mar 4 00:02:13 2008
@@ -31,11 +31,14 @@
private int[] indexes;
private CPUTF8[] names;
private CPUTF8[] descriptors;
+ private static final CPUTF8 attributeName = new CPUTF8(
+ "LocalVariableTable", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ); //$NON-NLS-1$
+
public LocalVariableTableAttribute(int local_variable_table_length,
int[] start_pcs, int[] lengths, CPUTF8[] names,
CPUTF8[] descriptors, int[] indexes) {
- super("LocalVariableTable");
+ super(attributeName);
this.local_variable_table_length = local_variable_table_length;
this.start_pcs = start_pcs;
this.lengths = lengths;
@@ -59,7 +62,6 @@
}
}
-
protected ClassFileEntry[] getNestedClassFileEntries() {
ArrayList nestedEntries = new ArrayList();
nestedEntries.add(getAttributeName());
@@ -128,7 +130,9 @@
// Given the index of the start_pc, we can now add
// the encodedLength to it to get the stop index.
int stopIndex = indexOfStartPC + encodedLength;
-
+ if(stopIndex < 0) {
+ System.out.println(stopIndex);
+ }
// 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()) {
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTypeTableAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTypeTableAttribute.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTypeTableAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTypeTableAttribute.java Tue Mar 4 00:02:13 2008
@@ -30,11 +30,14 @@
private int[] indexes;
private CPUTF8[] names;
private CPUTF8[] signatures;
+ private static final CPUTF8 attributeName = new CPUTF8(
+ "LocalVariableTypeTable", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ); //$NON-NLS-1$
+
public LocalVariableTypeTableAttribute(int local_variable_type_table_length,
int[] start_pcs, int[] lengths, CPUTF8[] names,
CPUTF8[] signatures, int[] indexes) {
- super("LocalVariableTypeTable");
+ super(attributeName);
this.local_variable_type_table_length = local_variable_type_table_length;
this.start_pcs = start_pcs;
this.lengths = lengths;
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/NewAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/NewAttribute.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/NewAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/NewAttribute.java Tue Mar 4 00:02:13 2008
@@ -31,7 +31,7 @@
private List body = new ArrayList();
private ClassConstantPool pool;
- public NewAttribute(String attributeName) {
+ public NewAttribute(CPUTF8 attributeName) {
super(attributeName);
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleAnnotationsAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleAnnotationsAttribute.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleAnnotationsAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleAnnotationsAttribute.java Tue Mar 4 00:02:13 2008
@@ -23,11 +23,9 @@
private int num_annotations;
private Annotation[] annotations;
- private String name;
- public RuntimeVisibleorInvisibleAnnotationsAttribute(String name, Annotation[] annotations) {
+ public RuntimeVisibleorInvisibleAnnotationsAttribute(CPUTF8 name, Annotation[] annotations) {
super(name);
- this.name = name;
this.num_annotations = annotations.length;
this.annotations = annotations;
}
@@ -55,7 +53,7 @@
}
public String toString() {
- return name + ": " + num_annotations + " annotations";
+ return attributeName.underlyingString() + ": " + num_annotations + " annotations";
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleParameterAnnotationsAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleParameterAnnotationsAttribute.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleParameterAnnotationsAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleParameterAnnotationsAttribute.java Tue Mar 4 00:02:13 2008
@@ -23,11 +23,9 @@
private int num_parameters;
private ParameterAnnotation[] parameter_annotations;
- private String name;
- public RuntimeVisibleorInvisibleParameterAnnotationsAttribute(String name, ParameterAnnotation[] parameter_annotations) {
+ public RuntimeVisibleorInvisibleParameterAnnotationsAttribute(CPUTF8 name, ParameterAnnotation[] parameter_annotations) {
super(name);
- this.name = name;
this.num_parameters = parameter_annotations.length;
this.parameter_annotations = parameter_annotations;
}
@@ -55,7 +53,7 @@
}
public String toString() {
- return name + ": " + num_parameters + " parameter annotations";
+ return attributeName.underlyingString() + ": " + num_parameters + " parameter annotations";
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SignatureAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SignatureAttribute.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SignatureAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SignatureAttribute.java Tue Mar 4 00:02:13 2008
@@ -24,8 +24,10 @@
private int signature_index;
private CPUTF8 signature;
+ private static final CPUTF8 attributeName = new CPUTF8("Signature", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ);
+
public SignatureAttribute(CPUTF8 value) {
- super("Signature");
+ super(attributeName);
this.signature = value;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SourceFileAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SourceFileAttribute.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SourceFileAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SourceFileAttribute.java Tue Mar 4 00:02:13 2008
@@ -19,15 +19,17 @@
import java.io.DataOutputStream;
import java.io.IOException;
-
public class SourceFileAttribute extends Attribute {
- private CPUTF8 name;
+ private CPUTF8 name;
private int nameIndex;
+ private static final CPUTF8 attributeName = new CPUTF8(
+ "SourceFile", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ); //$NON-NLS-1$
+
- public SourceFileAttribute(String name) {
- super("SourceFile"); //$NON-NLS-1$
- this.name = new CPUTF8(name, ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ);
+ public SourceFileAttribute(CPUTF8 name) {
+ super(attributeName);
+ this.name = name;
}
public boolean equals(Object obj) {
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ByteCodeForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ByteCodeForm.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ByteCodeForm.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/ByteCodeForm.java Tue Mar 4 00:02:13 2008
@@ -251,7 +251,7 @@
byteCodeArray[186] = new NoArgumentForm(186, "xxxunusedxxx");
byteCodeArray[187] = new NewClassRefForm(187, "new", new int[] {187, -1, -1});
byteCodeArray[188] = new ByteForm(188, "newarray", new int[] {188, -1});
- byteCodeArray[189] = new NewClassRefForm(189, "anewarray", new int[] {189, -1, -1});
+ byteCodeArray[189] = new ClassRefForm(189, "anewarray", new int[] {189, -1, -1});
byteCodeArray[190] = new NoArgumentForm(190, "arraylength");
byteCodeArray[191] = new NoArgumentForm(191, "athrow");
byteCodeArray[192] = new ClassRefForm(192, "checkcast", new int[] {192, -1, -1});
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/MultiANewArrayForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/MultiANewArrayForm.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/MultiANewArrayForm.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/MultiANewArrayForm.java Tue Mar 4 00:02:13 2008
@@ -22,11 +22,12 @@
/**
* This class implements the byte code form for the
* multianewarray instruction. It has a class reference
- * and a byte operand. Like other NewClassRefForms, it
- * keeps track of the last object created so other New
- * forms can make use of this information.
+ * and a byte operand.
+ *
+ * MultiANewArrayForms (like other anewarray
+ * forms) do not track the last new().
*/
-public class MultiANewArrayForm extends NewClassRefForm {
+public class MultiANewArrayForm extends ClassRefForm {
public MultiANewArrayForm(int opcode, String name,
int[] rewrite) {
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/NewInitMethodRefForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/NewInitMethodRefForm.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/NewInitMethodRefForm.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/NewInitMethodRefForm.java Tue Mar 4 00:02:13 2008
@@ -54,15 +54,6 @@
nested = new ClassFileEntry[] {
globalPool.getInitMethodPoolEntry(SegmentConstantPool.CP_METHOD, offset, context(operandManager))
};
- if(nested[0] == null) {
- // One class in JNDI isn't finding its
- // <init> method. Not sure why.
- // TODO: find out why.
- // org/apache/harmony/security/asn1/ASN1Type
- byteCode.setNested(new ClassFileEntry[]{});
- byteCode.setNestedPositions(new int[][] {{}});
- return;
- }
byteCode.setNested(nested);
byteCode.setNestedPositions(new int[][] {{0, 2}});
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/StringRefForm.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/StringRefForm.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/StringRefForm.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/forms/StringRefForm.java Tue Mar 4 00:02:13 2008
@@ -16,6 +16,7 @@
*/
package org.apache.harmony.pack200.bytecode.forms;
+import org.apache.harmony.pack200.CpBands;
import org.apache.harmony.pack200.Pack200Exception;
import org.apache.harmony.pack200.SegmentConstantPool;
import org.apache.harmony.pack200.bytecode.ByteCode;
@@ -60,7 +61,7 @@
SegmentConstantPool globalPool = operandManager.globalConstantPool();
ClassFileEntry[] nested = null;
nested = new ClassFileEntry[] {
- new CPString((String)globalPool.getValue(getPoolID(), offset))
+ ((CPString)globalPool.getValue(getPoolID(), offset))
};
byteCode.setNested(nested);
if(widened) {
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java Tue Mar 4 00:02:13 2008
@@ -96,6 +96,27 @@
archive.unpack();
}
+ // Test with an archive packed with the -E0 option
+ public void testWithE0() throws Exception {
+ in = Archive.class
+ .getResourceAsStream("/org/apache/harmony/pack200/tests/simple-E0.pack.gz");
+ out = new JarOutputStream(new FileOutputStream(File.createTempFile(
+ "simpleE0", ".jar")));
+ Archive archive = new Archive(in, out);
+ archive.unpack();
+ }
+
+ // Test with a class containing lots of local variables (regression test for
+ // HARMONY-5470)
+ public void testWithLargeClass() throws Exception {
+ in = Archive.class
+ .getResourceAsStream("/org/apache/harmony/pack200/tests/LargeClass.pack.gz");
+ out = new JarOutputStream(new FileOutputStream(File.createTempFile(
+ "largeclass", ".jar")));
+ Archive archive = new Archive(in, out);
+ archive.unpack();
+ }
+
protected void tearDown() throws Exception {
super.tearDown();
try {
@@ -117,8 +138,4 @@
}
}
-
-
-
-
-}
+}
\ No newline at end of file
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BcBandsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BcBandsTest.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BcBandsTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BcBandsTest.java Tue Mar 4 00:02:13 2008
@@ -343,12 +343,12 @@
//TODO: Need to fix this testcase so it has enough data to pass.
byte[] bytes = new byte[] {17, (byte)196, (byte)132, (byte)255,
8, 8,// bc_short band
- 8, 8, 8, 8}; // bc_locals band (required by wide iinc (196, 132))
+ 8}; // bc_locals band (required by wide iinc (196, 132))
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(3, bcBands.getMethodByteCodePacked()[0][0].length);
assertEquals(2, bcBands.getBcShort().length);
- assertEquals(2, bcBands.getBcLocal().length);
+ assertEquals(1, bcBands.getBcLocal().length);
}
/**
@@ -393,11 +393,11 @@
(byte) 196, (byte) 132, // wide iinc
(byte) 255,
0, // bc_short band
- 0, 0, 0, 1}; // bc_locals band
+ 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(2, bcBands.getBcLocal().length);
assertEquals(1, bcBands.getBcShort().length);
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ClassFileEntryTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ClassFileEntryTest.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ClassFileEntryTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ClassFileEntryTest.java Tue Mar 4 00:02:13 2008
@@ -29,10 +29,11 @@
import org.apache.harmony.pack200.bytecode.SourceFileAttribute;
public class ClassFileEntryTest extends TestCase {
+
public void testUTF8() {
- CPUTF8 u1 = new CPUTF8(new String("thing"), ClassConstantPool.DOMAIN_UNDEFINED); //$NON-NLS-1$
- CPUTF8 u2 = new CPUTF8(new String("thing"), ClassConstantPool.DOMAIN_UNDEFINED); //$NON-NLS-1$
- CPUTF8 u3 = new CPUTF8(new String("otherthing"), ClassConstantPool.DOMAIN_UNDEFINED); //$NON-NLS-1$
+ CPUTF8 u1 = new CPUTF8(new String("thing"), ClassConstantPool.DOMAIN_NORMALASCIIZ); //$NON-NLS-1$
+ CPUTF8 u2 = new CPUTF8(new String("thing"), ClassConstantPool.DOMAIN_NORMALASCIIZ); //$NON-NLS-1$
+ CPUTF8 u3 = new CPUTF8(new String("otherthing"), ClassConstantPool.DOMAIN_NORMALASCIIZ); //$NON-NLS-1$
checkEquality(u1, u2, "thing", u3);
}
private void checkEquality(Object equal1, Object equal2, String toString, Object unequal) {
@@ -45,9 +46,9 @@
assertFalse(unequal.equals(equal2));
}
public void testSourceAttribute() {
- SourceFileAttribute sfa1 = new SourceFileAttribute(new String("Thing.java")); //$NON-NLS-1$
- SourceFileAttribute sfa2 = new SourceFileAttribute(new String("Thing.java")); //$NON-NLS-1$
- SourceFileAttribute sfa3 = new SourceFileAttribute(new String("OtherThing.java")); //$NON-NLS-1$
+ SourceFileAttribute sfa1 = new SourceFileAttribute(new CPUTF8(new String("Thing.java"), ClassConstantPool.DOMAIN_NORMALASCIIZ)); //$NON-NLS-1$
+ SourceFileAttribute sfa2 = new SourceFileAttribute(new CPUTF8(new String("Thing.java"), ClassConstantPool.DOMAIN_NORMALASCIIZ)); //$NON-NLS-1$
+ SourceFileAttribute sfa3 = new SourceFileAttribute(new CPUTF8(new String("OtherThing.java"), ClassConstantPool.DOMAIN_NORMALASCIIZ)); //$NON-NLS-1$
checkEquality(sfa1,sfa2,"Thing.java",sfa3); //$NON-NLS-1$
}
public void testCPInteger() {
@@ -75,16 +76,16 @@
checkEquality(cp1,cp2,"3",cp3); //$NON-NLS-1$
}
public void testCPString() {
- CPString cp1 = new CPString(new String("3"));
- CPString cp2 = new CPString(new String("3"));
- CPString cp3 = new CPString(new String("5"));
+ CPString cp1 = new CPString(new CPUTF8(new String("3"), ClassConstantPool.DOMAIN_NORMALASCIIZ));
+ CPString cp2 = new CPString(new CPUTF8(new String("3"), ClassConstantPool.DOMAIN_NORMALASCIIZ));
+ CPString cp3 = new CPString(new CPUTF8(new String("5"), ClassConstantPool.DOMAIN_NORMALASCIIZ));
checkEquality(cp1,cp2,"3",cp3); //$NON-NLS-1$
}
public void testCPField() {
- CPMember cp1 = new CPMember("Name:I", 0, null);
- CPMember cp2 = new CPMember("Name:I", 0, null);
- CPMember cp3 = new CPMember("Name:Z", 0, null);
- CPMember cp4 = new CPMember("GName:I", 0, null);
+ CPMember cp1 = new CPMember(new CPUTF8("Name", ClassConstantPool.DOMAIN_NORMALASCIIZ), new CPUTF8("I", ClassConstantPool.DOMAIN_NORMALASCIIZ), 0, null);
+ CPMember cp2 = new CPMember(new CPUTF8("Name", ClassConstantPool.DOMAIN_NORMALASCIIZ), new CPUTF8("I", ClassConstantPool.DOMAIN_NORMALASCIIZ), 0, null);
+ CPMember cp3 = new CPMember(new CPUTF8("Name", ClassConstantPool.DOMAIN_NORMALASCIIZ), new CPUTF8("Z", ClassConstantPool.DOMAIN_NORMALASCIIZ), 0, null);
+ CPMember cp4 = new CPMember(new CPUTF8("GName", ClassConstantPool.DOMAIN_NORMALASCIIZ), new CPUTF8("I", ClassConstantPool.DOMAIN_NORMALASCIIZ), 0, null);
checkEquality(cp1,cp2,"Name",cp3); //$NON-NLS-1$
checkEquality(cp1,cp2,"I",cp4); //$NON-NLS-1$
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ConstantPoolTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ConstantPoolTest.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ConstantPoolTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ConstantPoolTest.java Tue Mar 4 00:02:13 2008
@@ -18,6 +18,7 @@
import junit.framework.TestCase;
+import org.apache.harmony.pack200.CpBands;
import org.apache.harmony.pack200.bytecode.CPMember;
import org.apache.harmony.pack200.bytecode.CPUTF8;
import org.apache.harmony.pack200.bytecode.ClassConstantPool;
@@ -36,10 +37,10 @@
assertEquals(1,pool.size());
}
public void testDuplicateField() {
- CPMember cp1 = new CPMember("name:I",0,null);
+ CPMember cp1 = new CPMember(new CPUTF8("name", ClassConstantPool.DOMAIN_NORMALASCIIZ), new CPUTF8("I", ClassConstantPool.DOMAIN_NORMALASCIIZ),0,null);
pool.add(cp1);
assertEquals(2,pool.size());
- CPMember cp2 = new CPMember("name:I",0,null);
+ CPMember cp2 = new CPMember(new CPUTF8("name", ClassConstantPool.DOMAIN_NORMALASCIIZ), new CPUTF8("I", ClassConstantPool.DOMAIN_NORMALASCIIZ),0,null);
pool.add(cp2);
assertEquals(2,pool.size());
}
Modified: harmony/enhanced/classlib/branches/java6/modules/regex/src/main/java/java/util/regex/Pattern.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/regex/src/main/java/java/util/regex/Pattern.java?rev=633384&r1=633383&r2=633384&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/regex/src/main/java/java/util/regex/Pattern.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/regex/src/main/java/java/util/regex/Pattern.java Tue Mar 4 00:02:13 2008
@@ -215,59 +215,60 @@
}
/**
- * Return a compiled pattern corresponding to the input regular expression
- * string.
- *
- * The input <code>flags</code> is a mask of the following flags:
- * <dl>
- * <dt><code>UNIX_LINES</code> (0x0001)
- * <dd>Enables UNIX lines mode where only \n is recognized as a line
- * terminator. The default setting of this flag is <em>off</em> indicating
- * that all of the following character sequences are recognized as line
- * terminators: \n, \r, \r\n, NEL (\u0085), \u2028 and \u2029.
- * <dt><code>CASE_INSENSITIVE</code> (0x0002)
- * <dd>Directs matching to be done in a way that ignores differences in
- * case. If input character sequences are encoded in character sets other
- * than ASCII, then the UNICODE_CASE must also be set to enable Unicode case
- * detection.
- * <dt><code>UNICODE_CASE</code> (0x0040)
- * <dd>Enables Unicode case folding if used in conjunction with the
- * <code>CASE_INSENSITIVE</code> flag. If <code>CASE_INSENSITIVE</code>
- * is not set, then this flag has no effect.
- * <dt><code>COMMENTS</code> (0x0004)
- * <dd>Directs the pattern compiler to ignore whitespace and comments in
- * the pattern. Whitespace consists of sequences including only these
- * characters: SP (\u0020), HT (\t or \u0009), LF (\n or ), VT (\u000b), FF
- * (\f or \u000c), and CR (\r or ). A comment is any sequence of characters
- * beginning with the "#" (\u0023) character and ending in a LF character.
- * <dt><code>MULTILINE</code> (0x0008)
- * <dd>Turns on multiple line mode for matching of character sequences. By
- * default, this mode is off so that the character "^" (\u005e) matches the
- * beginning of the entire input sequence and the character "$" (\u0024)
- * matches the end of the input character sequence. In multiple line mode,
- * the character "^" matches any character in the input sequence which
- * immediately follows a line terminator and the character "$" matches any
- * character in the input sequence which immediately precedes a line
- * terminator.
- * <dt><code>DOTALL</code> (0x0020)
- * <dd>Enables the DOT (".") character in regular expressions to match line
- * terminators. By default, line terminators are not matched by DOT.
- * <dt><code>CANON_EQ</code> (0x0080)
- * <dd>Enables matching of character sequences which are canonically
- * equivalent according to the Unicode standard. Canonical equivalence is
- * described here: http://www.unicode.org/reports/tr15/. By default,
- * canonical equivalence is not detected while matching.
- * </dl>
- *
- * @param regex
- * A regular expression string.
- * @param flags
- * A set of flags to control the compilation of the pattern.
- * @return A compiled pattern
- * @throws PatternSyntaxException
- * If the input regular expression does not match the required
- * grammar.
- */
+ * Return a compiled pattern corresponding to the input regular expression
+ * string.
+ *
+ * The input <code>flags</code> is a mask of the following flags:
+ * <dl>
+ * <dt><code>UNIX_LINES</code> (0x0001)
+ * <dd>Enables UNIX lines mode where only \n is recognized as a line
+ * terminator. The default setting of this flag is <em>off</em> indicating
+ * that all of the following character sequences are recognized as line
+ * terminators: \n, \r, \r\n, NEL (\u0085), \u2028 and \u2029.
+ * <dt><code>CASE_INSENSITIVE</code> (0x0002)
+ * <dd>Directs matching to be done in a way that ignores differences in
+ * case. If input character sequences are encoded in character sets other
+ * than ASCII, then the UNICODE_CASE must also be set to enable Unicode case
+ * detection.
+ * <dt><code>UNICODE_CASE</code> (0x0040)
+ * <dd>Enables Unicode case folding if used in conjunction with the
+ * <code>CASE_INSENSITIVE</code> flag. If <code>CASE_INSENSITIVE</code>
+ * is not set, then this flag has no effect.
+ * <dt><code>COMMENTS</code> (0x0004)
+ * <dd>Directs the pattern compiler to ignore whitespace and comments in
+ * the pattern. Whitespace consists of sequences including only these
+ * characters: SP (\u0020), HT (\t or \u0009), LF (\n or ), VT
+ * (\u000b), FF (\f or \u000c), and CR (\r or ). A comment is any
+ * sequence of characters beginning with the "#" (\u0023) character and
+ * ending in a LF character.
+ * <dt><code>MULTILINE</code> (0x0008)
+ * <dd>Turns on multiple line mode for matching of character sequences. By
+ * default, this mode is off so that the character "^" (\u005e) matches
+ * the beginning of the entire input sequence and the character "$"
+ * (\u0024) matches the end of the input character sequence. In multiple
+ * line mode, the character "^" matches any character in the input sequence
+ * which immediately follows a line terminator and the character "$" matches
+ * any character in the input sequence which immediately precedes a line
+ * terminator.
+ * <dt><code>DOTALL</code> (0x0020)
+ * <dd>Enables the DOT (".") character in regular expressions to match line
+ * terminators. By default, line terminators are not matched by DOT.
+ * <dt><code>CANON_EQ</code> (0x0080)
+ * <dd>Enables matching of character sequences which are canonically
+ * equivalent according to the Unicode standard. Canonical equivalence is
+ * described here: http://www.unicode.org/reports/tr15/. By default,
+ * canonical equivalence is not detected while matching.
+ * </dl>
+ *
+ * @param regex
+ * A regular expression string.
+ * @param flags
+ * A set of flags to control the compilation of the pattern.
+ * @return A compiled pattern
+ * @throws PatternSyntaxException
+ * If the input regular expression does not match the required
+ * grammar.
+ */
public static Pattern compile(String regex, int flags)
throws PatternSyntaxException {