You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2014/05/31 00:51:30 UTC
svn commit: r1598766 [3/12] - in /commons/proper/bcel/trunk/src:
main/java/org/apache/bcel/ main/java/org/apache/bcel/classfile/
main/java/org/apache/bcel/generic/ main/java/org/apache/bcel/util/
main/java/org/apache/bcel/verifier/exc/ main/java/org/ap...
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java?rev=1598766&r1=1598765&r2=1598766&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java Fri May 30 22:51:27 2014
@@ -79,16 +79,16 @@ public class ConstantPoolGen implements
*/
public ConstantPoolGen(Constant[] cs) {
StringBuilder sb = new StringBuilder(256);
-
+
size = Math.max(256, cs.length + 64);
constants = new Constant[size];
-
+
System.arraycopy(cs, 0, constants, 0, cs.length);
if (cs.length > 0) {
index = cs.length;
}
-
-
+
+
for (int i = 1; i < index; i++) {
Constant c = constants[i];
if (c instanceof ConstantString) {
@@ -109,13 +109,13 @@ public class ConstantPoolGen implements
ConstantNameAndType n = (ConstantNameAndType) c;
ConstantUtf8 u8 = (ConstantUtf8) constants[n.getNameIndex()];
ConstantUtf8 u8_2 = (ConstantUtf8) constants[n.getSignatureIndex()];
-
+
sb.append(u8.getBytes());
sb.append(NAT_DELIM);
sb.append(u8_2.getBytes());
String key = sb.toString();
sb.delete(0, sb.length());
-
+
if (!n_a_t_table.containsKey(key)) {
n_a_t_table.put(key, new Index(i));
}
@@ -141,7 +141,7 @@ public class ConstantPoolGen implements
} else if (c instanceof ConstantFieldref) {
delim = FIELDREF_DELIM;
}
-
+
sb.append(class_name);
sb.append(delim);
sb.append(method_name);
@@ -149,7 +149,7 @@ public class ConstantPoolGen implements
sb.append(signature);
String key = sb.toString();
sb.delete(0, sb.length());
-
+
if (!cp_table.containsKey(key)) {
cp_table.put(key, new Index(i));
}
@@ -170,7 +170,7 @@ public class ConstantPoolGen implements
* Create empty constant pool.
*/
public ConstantPoolGen() {
- size = 256;
+ size = 256;
constants = new Constant[size];
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementValueGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementValueGen.java?rev=1598766&r1=1598765&r2=1598766&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementValueGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementValueGen.java Fri May 30 22:51:27 2014
@@ -31,155 +31,155 @@ import org.apache.bcel.classfile.SimpleE
public abstract class ElementValueGen
{
- protected int type;
+ protected int type;
- protected ConstantPoolGen cpGen;
+ protected ConstantPoolGen cpGen;
- protected ElementValueGen(int type, ConstantPoolGen cpGen)
- {
- this.type = type;
- this.cpGen = cpGen;
- }
-
- /**
- * Subtypes return an immutable variant of the ElementValueGen
- */
- public abstract ElementValue getElementValue();
-
- public int getElementValueType()
- {
- return type;
- }
-
- public abstract String stringifyValue();
-
- public abstract void dump(DataOutputStream dos) throws IOException;
-
- public static final int STRING = 's';
-
- public static final int ENUM_CONSTANT = 'e';
-
- public static final int CLASS = 'c';
-
- public static final int ANNOTATION = '@';
-
- public static final int ARRAY = '[';
-
- public static final int PRIMITIVE_INT = 'I';
-
- public static final int PRIMITIVE_BYTE = 'B';
-
- public static final int PRIMITIVE_CHAR = 'C';
-
- public static final int PRIMITIVE_DOUBLE = 'D';
-
- public static final int PRIMITIVE_FLOAT = 'F';
-
- public static final int PRIMITIVE_LONG = 'J';
-
- public static final int PRIMITIVE_SHORT = 'S';
-
- public static final int PRIMITIVE_BOOLEAN = 'Z';
-
- public static ElementValueGen readElementValue(DataInputStream dis,
- ConstantPoolGen cpGen) throws IOException
- {
- int type = dis.readUnsignedByte();
- switch (type)
- {
- case 'B': // byte
- return new SimpleElementValueGen(PRIMITIVE_BYTE, dis
- .readUnsignedShort(), cpGen);
- case 'C': // char
- return new SimpleElementValueGen(PRIMITIVE_CHAR, dis
- .readUnsignedShort(), cpGen);
- case 'D': // double
- return new SimpleElementValueGen(PRIMITIVE_DOUBLE, dis
- .readUnsignedShort(), cpGen);
- case 'F': // float
- return new SimpleElementValueGen(PRIMITIVE_FLOAT, dis
- .readUnsignedShort(), cpGen);
- case 'I': // int
- return new SimpleElementValueGen(PRIMITIVE_INT, dis
- .readUnsignedShort(), cpGen);
- case 'J': // long
- return new SimpleElementValueGen(PRIMITIVE_LONG, dis
- .readUnsignedShort(), cpGen);
- case 'S': // short
- return new SimpleElementValueGen(PRIMITIVE_SHORT, dis
- .readUnsignedShort(), cpGen);
- case 'Z': // boolean
- return new SimpleElementValueGen(PRIMITIVE_BOOLEAN, dis
- .readUnsignedShort(), cpGen);
- case 's': // String
- return new SimpleElementValueGen(STRING, dis.readUnsignedShort(),
- cpGen);
- case 'e': // Enum constant
- return new EnumElementValueGen(dis.readUnsignedShort(), dis
- .readUnsignedShort(), cpGen);
- case 'c': // Class
- return new ClassElementValueGen(dis.readUnsignedShort(), cpGen);
- case '@': // Annotation
- // TODO: isRuntimeVisible ??????????
- // FIXME
- return new AnnotationElementValueGen(ANNOTATION,
- new AnnotationEntryGen(AnnotationEntry.read(dis, cpGen
- .getConstantPool(), true), cpGen, false), cpGen);
- case '[': // Array
- int numArrayVals = dis.readUnsignedShort();
- ElementValue[] evalues = new ElementValue[numArrayVals];
- for (int j = 0; j < numArrayVals; j++)
- {
- evalues[j] = ElementValue.readElementValue(dis, cpGen
- .getConstantPool());
- }
- return new ArrayElementValueGen(ARRAY, evalues, cpGen);
- default:
- throw new RuntimeException(
- "Unexpected element value kind in annotation: " + type);
- }
- }
-
- protected ConstantPoolGen getConstantPool()
- {
- return cpGen;
- }
-
- /**
- * Creates an (modifiable) ElementValueGen copy of an (immutable)
- * ElementValue - constant pool is assumed correct.
- */
- public static ElementValueGen copy(ElementValue value,
- ConstantPoolGen cpool, boolean copyPoolEntries)
- {
- switch (value.getElementValueType())
- {
- case 'B': // byte
- case 'C': // char
- case 'D': // double
- case 'F': // float
- case 'I': // int
- case 'J': // long
- case 'S': // short
- case 'Z': // boolean
- case 's': // String
- return new SimpleElementValueGen((SimpleElementValue) value, cpool,
- copyPoolEntries);
- case 'e': // Enum constant
- return new EnumElementValueGen((EnumElementValue) value, cpool,
- copyPoolEntries);
- case '@': // Annotation
- return new AnnotationElementValueGen(
- (AnnotationElementValue) value, cpool, copyPoolEntries);
- case '[': // Array
- return new ArrayElementValueGen((ArrayElementValue) value, cpool,
- copyPoolEntries);
- case 'c': // Class
- return new ClassElementValueGen((ClassElementValue) value, cpool,
- copyPoolEntries);
- default:
- throw new RuntimeException("Not implemented yet! ("
- + value.getElementValueType() + ")");
- }
- }
+ protected ElementValueGen(int type, ConstantPoolGen cpGen)
+ {
+ this.type = type;
+ this.cpGen = cpGen;
+ }
+
+ /**
+ * Subtypes return an immutable variant of the ElementValueGen
+ */
+ public abstract ElementValue getElementValue();
+
+ public int getElementValueType()
+ {
+ return type;
+ }
+
+ public abstract String stringifyValue();
+
+ public abstract void dump(DataOutputStream dos) throws IOException;
+
+ public static final int STRING = 's';
+
+ public static final int ENUM_CONSTANT = 'e';
+
+ public static final int CLASS = 'c';
+
+ public static final int ANNOTATION = '@';
+
+ public static final int ARRAY = '[';
+
+ public static final int PRIMITIVE_INT = 'I';
+
+ public static final int PRIMITIVE_BYTE = 'B';
+
+ public static final int PRIMITIVE_CHAR = 'C';
+
+ public static final int PRIMITIVE_DOUBLE = 'D';
+
+ public static final int PRIMITIVE_FLOAT = 'F';
+
+ public static final int PRIMITIVE_LONG = 'J';
+
+ public static final int PRIMITIVE_SHORT = 'S';
+
+ public static final int PRIMITIVE_BOOLEAN = 'Z';
+
+ public static ElementValueGen readElementValue(DataInputStream dis,
+ ConstantPoolGen cpGen) throws IOException
+ {
+ int type = dis.readUnsignedByte();
+ switch (type)
+ {
+ case 'B': // byte
+ return new SimpleElementValueGen(PRIMITIVE_BYTE, dis
+ .readUnsignedShort(), cpGen);
+ case 'C': // char
+ return new SimpleElementValueGen(PRIMITIVE_CHAR, dis
+ .readUnsignedShort(), cpGen);
+ case 'D': // double
+ return new SimpleElementValueGen(PRIMITIVE_DOUBLE, dis
+ .readUnsignedShort(), cpGen);
+ case 'F': // float
+ return new SimpleElementValueGen(PRIMITIVE_FLOAT, dis
+ .readUnsignedShort(), cpGen);
+ case 'I': // int
+ return new SimpleElementValueGen(PRIMITIVE_INT, dis
+ .readUnsignedShort(), cpGen);
+ case 'J': // long
+ return new SimpleElementValueGen(PRIMITIVE_LONG, dis
+ .readUnsignedShort(), cpGen);
+ case 'S': // short
+ return new SimpleElementValueGen(PRIMITIVE_SHORT, dis
+ .readUnsignedShort(), cpGen);
+ case 'Z': // boolean
+ return new SimpleElementValueGen(PRIMITIVE_BOOLEAN, dis
+ .readUnsignedShort(), cpGen);
+ case 's': // String
+ return new SimpleElementValueGen(STRING, dis.readUnsignedShort(),
+ cpGen);
+ case 'e': // Enum constant
+ return new EnumElementValueGen(dis.readUnsignedShort(), dis
+ .readUnsignedShort(), cpGen);
+ case 'c': // Class
+ return new ClassElementValueGen(dis.readUnsignedShort(), cpGen);
+ case '@': // Annotation
+ // TODO: isRuntimeVisible ??????????
+ // FIXME
+ return new AnnotationElementValueGen(ANNOTATION,
+ new AnnotationEntryGen(AnnotationEntry.read(dis, cpGen
+ .getConstantPool(), true), cpGen, false), cpGen);
+ case '[': // Array
+ int numArrayVals = dis.readUnsignedShort();
+ ElementValue[] evalues = new ElementValue[numArrayVals];
+ for (int j = 0; j < numArrayVals; j++)
+ {
+ evalues[j] = ElementValue.readElementValue(dis, cpGen
+ .getConstantPool());
+ }
+ return new ArrayElementValueGen(ARRAY, evalues, cpGen);
+ default:
+ throw new RuntimeException(
+ "Unexpected element value kind in annotation: " + type);
+ }
+ }
+
+ protected ConstantPoolGen getConstantPool()
+ {
+ return cpGen;
+ }
+
+ /**
+ * Creates an (modifiable) ElementValueGen copy of an (immutable)
+ * ElementValue - constant pool is assumed correct.
+ */
+ public static ElementValueGen copy(ElementValue value,
+ ConstantPoolGen cpool, boolean copyPoolEntries)
+ {
+ switch (value.getElementValueType())
+ {
+ case 'B': // byte
+ case 'C': // char
+ case 'D': // double
+ case 'F': // float
+ case 'I': // int
+ case 'J': // long
+ case 'S': // short
+ case 'Z': // boolean
+ case 's': // String
+ return new SimpleElementValueGen((SimpleElementValue) value, cpool,
+ copyPoolEntries);
+ case 'e': // Enum constant
+ return new EnumElementValueGen((EnumElementValue) value, cpool,
+ copyPoolEntries);
+ case '@': // Annotation
+ return new AnnotationElementValueGen(
+ (AnnotationElementValue) value, cpool, copyPoolEntries);
+ case '[': // Array
+ return new ArrayElementValueGen((ArrayElementValue) value, cpool,
+ copyPoolEntries);
+ case 'c': // Class
+ return new ClassElementValueGen((ClassElementValue) value, cpool,
+ copyPoolEntries);
+ default:
+ throw new RuntimeException("Not implemented yet! ("
+ + value.getElementValueType() + ")");
+ }
+ }
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementValuePairGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementValuePairGen.java?rev=1598766&r1=1598765&r2=1598766&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementValuePairGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementValuePairGen.java Fri May 30 22:51:27 2014
@@ -25,87 +25,87 @@ import org.apache.bcel.classfile.Element
public class ElementValuePairGen
{
- private int nameIdx;
+ private int nameIdx;
- private ElementValueGen value;
+ private ElementValueGen value;
- private ConstantPoolGen cpool;
+ private ConstantPoolGen cpool;
- public ElementValuePairGen(ElementValuePair nvp, ConstantPoolGen cpool,
- boolean copyPoolEntries)
- {
- this.cpool = cpool;
- // J5ASSERT:
- // Could assert nvp.getNameString() points to the same thing as
- // cpool.getConstant(nvp.getNameIndex())
- // if
- // (!nvp.getNameString().equals(((ConstantUtf8)cpool.getConstant(nvp.getNameIndex())).getBytes()))
- // {
- // throw new RuntimeException("envp buggered");
- // }
- if (copyPoolEntries)
- {
- nameIdx = cpool.addUtf8(nvp.getNameString());
- }
- else
- {
- nameIdx = nvp.getNameIndex();
- }
- value = ElementValueGen.copy(nvp.getValue(), cpool, copyPoolEntries);
- }
-
- /**
- * Retrieve an immutable version of this ElementNameValuePairGen
- */
- public ElementValuePair getElementNameValuePair()
- {
- ElementValue immutableValue = value.getElementValue();
- return new ElementValuePair(nameIdx, immutableValue, cpool
- .getConstantPool());
- }
-
- protected ElementValuePairGen(int idx, ElementValueGen value,
- ConstantPoolGen cpool)
- {
- this.nameIdx = idx;
- this.value = value;
- this.cpool = cpool;
- }
-
- public ElementValuePairGen(String name, ElementValueGen value,
- ConstantPoolGen cpool)
- {
- this.nameIdx = cpool.addUtf8(name);
- this.value = value;
- this.cpool = cpool;
- }
-
- protected void dump(DataOutputStream dos) throws IOException
- {
- dos.writeShort(nameIdx); // u2 name of the element
- value.dump(dos);
- }
-
- public int getNameIndex()
- {
- return nameIdx;
- }
-
- public final String getNameString()
- {
- // ConstantString cu8 = (ConstantString)cpool.getConstant(nameIdx);
- return ((ConstantUtf8) cpool.getConstant(nameIdx)).getBytes();
- }
-
- public final ElementValueGen getValue()
- {
- return value;
- }
+ public ElementValuePairGen(ElementValuePair nvp, ConstantPoolGen cpool,
+ boolean copyPoolEntries)
+ {
+ this.cpool = cpool;
+ // J5ASSERT:
+ // Could assert nvp.getNameString() points to the same thing as
+ // cpool.getConstant(nvp.getNameIndex())
+ // if
+ // (!nvp.getNameString().equals(((ConstantUtf8)cpool.getConstant(nvp.getNameIndex())).getBytes()))
+ // {
+ // throw new RuntimeException("envp buggered");
+ // }
+ if (copyPoolEntries)
+ {
+ nameIdx = cpool.addUtf8(nvp.getNameString());
+ }
+ else
+ {
+ nameIdx = nvp.getNameIndex();
+ }
+ value = ElementValueGen.copy(nvp.getValue(), cpool, copyPoolEntries);
+ }
+
+ /**
+ * Retrieve an immutable version of this ElementNameValuePairGen
+ */
+ public ElementValuePair getElementNameValuePair()
+ {
+ ElementValue immutableValue = value.getElementValue();
+ return new ElementValuePair(nameIdx, immutableValue, cpool
+ .getConstantPool());
+ }
+
+ protected ElementValuePairGen(int idx, ElementValueGen value,
+ ConstantPoolGen cpool)
+ {
+ this.nameIdx = idx;
+ this.value = value;
+ this.cpool = cpool;
+ }
+
+ public ElementValuePairGen(String name, ElementValueGen value,
+ ConstantPoolGen cpool)
+ {
+ this.nameIdx = cpool.addUtf8(name);
+ this.value = value;
+ this.cpool = cpool;
+ }
+
+ protected void dump(DataOutputStream dos) throws IOException
+ {
+ dos.writeShort(nameIdx); // u2 name of the element
+ value.dump(dos);
+ }
+
+ public int getNameIndex()
+ {
+ return nameIdx;
+ }
+
+ public final String getNameString()
+ {
+ // ConstantString cu8 = (ConstantString)cpool.getConstant(nameIdx);
+ return ((ConstantUtf8) cpool.getConstant(nameIdx)).getBytes();
+ }
+
+ public final ElementValueGen getValue()
+ {
+ return value;
+ }
- @Override
+ @Override
public String toString()
- {
- return "ElementValuePair:[" + getNameString() + "="
- + value.stringifyValue() + "]";
- }
+ {
+ return "ElementValuePair:[" + getNameString() + "="
+ + value.stringifyValue() + "]";
+ }
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/EmptyVisitor.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/EmptyVisitor.java?rev=1598766&r1=1598765&r2=1598766&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/EmptyVisitor.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/EmptyVisitor.java Fri May 30 22:51:27 2014
@@ -745,8 +745,8 @@ public abstract class EmptyVisitor imple
}
public void visitNameSignatureInstruction(NameSignatureInstruction obj) {
- }
-
- public void visitINVOKEDYNAMIC(INVOKEDYNAMIC obj) {
- }
+ }
+
+ public void visitINVOKEDYNAMIC(INVOKEDYNAMIC obj) {
+ }
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/EnumElementValueGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/EnumElementValueGen.java?rev=1598766&r1=1598765&r2=1598766&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/EnumElementValueGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/EnumElementValueGen.java Fri May 30 22:51:27 2014
@@ -25,116 +25,116 @@ import org.apache.bcel.classfile.EnumEle
public class EnumElementValueGen extends ElementValueGen
{
- // For enum types, these two indices point to the type and value
- private int typeIdx;
+ // For enum types, these two indices point to the type and value
+ private int typeIdx;
- private int valueIdx;
+ private int valueIdx;
- /**
- * This ctor assumes the constant pool already contains the right type and
- * value - as indicated by typeIdx and valueIdx. This ctor is used for
- * deserialization
- */
- protected EnumElementValueGen(int typeIdx, int valueIdx,
- ConstantPoolGen cpool)
- {
- super(ElementValueGen.ENUM_CONSTANT, cpool);
- if (type != ENUM_CONSTANT) {
+ /**
+ * This ctor assumes the constant pool already contains the right type and
+ * value - as indicated by typeIdx and valueIdx. This ctor is used for
+ * deserialization
+ */
+ protected EnumElementValueGen(int typeIdx, int valueIdx,
+ ConstantPoolGen cpool)
+ {
+ super(ElementValueGen.ENUM_CONSTANT, cpool);
+ if (type != ENUM_CONSTANT) {
throw new RuntimeException(
- "Only element values of type enum can be built with this ctor - type specified: " + type);
+ "Only element values of type enum can be built with this ctor - type specified: " + type);
}
- this.typeIdx = typeIdx;
- this.valueIdx = valueIdx;
- }
-
- /**
- * Return immutable variant of this EnumElementValue
- */
- @Override
+ this.typeIdx = typeIdx;
+ this.valueIdx = valueIdx;
+ }
+
+ /**
+ * Return immutable variant of this EnumElementValue
+ */
+ @Override
public ElementValue getElementValue()
- {
- System.err.println("Duplicating value: " + getEnumTypeString() + ":"
- + getEnumValueString());
- return new EnumElementValue(type, typeIdx, valueIdx, cpGen
- .getConstantPool());
- }
-
- public EnumElementValueGen(ObjectType t, String value, ConstantPoolGen cpool)
- {
- super(ElementValueGen.ENUM_CONSTANT, cpool);
- typeIdx = cpool.addUtf8(t.getSignature());// was addClass(t);
- valueIdx = cpool.addUtf8(value);// was addString(value);
- }
-
- public EnumElementValueGen(EnumElementValue value, ConstantPoolGen cpool,
- boolean copyPoolEntries)
- {
- super(ENUM_CONSTANT, cpool);
- if (copyPoolEntries)
- {
- typeIdx = cpool.addUtf8(value.getEnumTypeString());// was
- // addClass(value.getEnumTypeString());
- valueIdx = cpool.addUtf8(value.getEnumValueString()); // was
- // addString(value.getEnumValueString());
- }
- else
- {
- typeIdx = value.getTypeIndex();
- valueIdx = value.getValueIndex();
- }
- }
+ {
+ System.err.println("Duplicating value: " + getEnumTypeString() + ":"
+ + getEnumValueString());
+ return new EnumElementValue(type, typeIdx, valueIdx, cpGen
+ .getConstantPool());
+ }
+
+ public EnumElementValueGen(ObjectType t, String value, ConstantPoolGen cpool)
+ {
+ super(ElementValueGen.ENUM_CONSTANT, cpool);
+ typeIdx = cpool.addUtf8(t.getSignature());// was addClass(t);
+ valueIdx = cpool.addUtf8(value);// was addString(value);
+ }
+
+ public EnumElementValueGen(EnumElementValue value, ConstantPoolGen cpool,
+ boolean copyPoolEntries)
+ {
+ super(ENUM_CONSTANT, cpool);
+ if (copyPoolEntries)
+ {
+ typeIdx = cpool.addUtf8(value.getEnumTypeString());// was
+ // addClass(value.getEnumTypeString());
+ valueIdx = cpool.addUtf8(value.getEnumValueString()); // was
+ // addString(value.getEnumValueString());
+ }
+ else
+ {
+ typeIdx = value.getTypeIndex();
+ valueIdx = value.getValueIndex();
+ }
+ }
- @Override
+ @Override
public void dump(DataOutputStream dos) throws IOException
- {
- dos.writeByte(type); // u1 type of value (ENUM_CONSTANT == 'e')
- dos.writeShort(typeIdx); // u2
- dos.writeShort(valueIdx); // u2
- }
+ {
+ dos.writeByte(type); // u1 type of value (ENUM_CONSTANT == 'e')
+ dos.writeShort(typeIdx); // u2
+ dos.writeShort(valueIdx); // u2
+ }
- @Override
+ @Override
public String stringifyValue()
- {
- ConstantUtf8 cu8 = (ConstantUtf8) getConstantPool().getConstant(
- valueIdx);
- return cu8.getBytes();
- // ConstantString cu8 =
- // (ConstantString)getConstantPool().getConstant(valueIdx);
- // return
- // ((ConstantUtf8)getConstantPool().getConstant(cu8.getStringIndex())).getBytes();
- }
-
- // BCELBUG: Should we need to call utility.signatureToString() on the output
- // here?
- public String getEnumTypeString()
- {
- // Constant cc = getConstantPool().getConstant(typeIdx);
- // ConstantClass cu8 =
- // (ConstantClass)getConstantPool().getConstant(typeIdx);
- // return
- // ((ConstantUtf8)getConstantPool().getConstant(cu8.getNameIndex())).getBytes();
- return ((ConstantUtf8) getConstantPool().getConstant(typeIdx))
- .getBytes();
- // return Utility.signatureToString(cu8.getBytes());
- }
-
- public String getEnumValueString()
- {
- return ((ConstantUtf8) getConstantPool().getConstant(valueIdx))
- .getBytes();
- // ConstantString cu8 =
- // (ConstantString)getConstantPool().getConstant(valueIdx);
- // return
- // ((ConstantUtf8)getConstantPool().getConstant(cu8.getStringIndex())).getBytes();
- }
-
- public int getValueIndex()
- {
- return valueIdx;
- }
-
- public int getTypeIndex()
- {
- return typeIdx;
- }
+ {
+ ConstantUtf8 cu8 = (ConstantUtf8) getConstantPool().getConstant(
+ valueIdx);
+ return cu8.getBytes();
+ // ConstantString cu8 =
+ // (ConstantString)getConstantPool().getConstant(valueIdx);
+ // return
+ // ((ConstantUtf8)getConstantPool().getConstant(cu8.getStringIndex())).getBytes();
+ }
+
+ // BCELBUG: Should we need to call utility.signatureToString() on the output
+ // here?
+ public String getEnumTypeString()
+ {
+ // Constant cc = getConstantPool().getConstant(typeIdx);
+ // ConstantClass cu8 =
+ // (ConstantClass)getConstantPool().getConstant(typeIdx);
+ // return
+ // ((ConstantUtf8)getConstantPool().getConstant(cu8.getNameIndex())).getBytes();
+ return ((ConstantUtf8) getConstantPool().getConstant(typeIdx))
+ .getBytes();
+ // return Utility.signatureToString(cu8.getBytes());
+ }
+
+ public String getEnumValueString()
+ {
+ return ((ConstantUtf8) getConstantPool().getConstant(valueIdx))
+ .getBytes();
+ // ConstantString cu8 =
+ // (ConstantString)getConstantPool().getConstant(valueIdx);
+ // return
+ // ((ConstantUtf8)getConstantPool().getConstant(cu8.getStringIndex())).getBytes();
+ }
+
+ public int getValueIndex()
+ {
+ return valueIdx;
+ }
+
+ public int getTypeIndex()
+ {
+ return typeIdx;
+ }
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/FieldGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/FieldGen.java?rev=1598766&r1=1598765&r2=1598766&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/FieldGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/FieldGen.java Fri May 30 22:51:27 2014
@@ -92,11 +92,11 @@ public class FieldGen extends FieldGenOr
if (attr instanceof ConstantValue) {
setValue(((ConstantValue) attr).getConstantValueIndex());
} else if (attr instanceof Annotations) {
- Annotations runtimeAnnotations = (Annotations)attr;
- AnnotationEntry[] annotationEntries = runtimeAnnotations.getAnnotationEntries();
- for (AnnotationEntry element : annotationEntries) {
- addAnnotationEntry(new AnnotationEntryGen(element,cp,false));
- }
+ Annotations runtimeAnnotations = (Annotations)attr;
+ AnnotationEntry[] annotationEntries = runtimeAnnotations.getAnnotationEntries();
+ for (AnnotationEntry element : annotationEntries) {
+ addAnnotationEntry(new AnnotationEntryGen(element,cp,false));
+ }
} else {
addAttribute(attr);
}
@@ -224,12 +224,12 @@ public class FieldGen extends FieldGenOr
return new Field(access_flags, name_index, signature_index, getAttributes(), cp
.getConstantPool());
}
-
+
private void addAnnotationsAsAttribute(ConstantPoolGen cp) {
- Attribute[] attrs = Utility.getAnnotationAttributes(cp,annotation_vec);
+ Attribute[] attrs = Utility.getAnnotationAttributes(cp,annotation_vec);
for (Attribute attr : attrs) {
- addAttribute(attr);
- }
+ addAttribute(attr);
+ }
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/FieldGenOrMethodGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/FieldGenOrMethodGen.java?rev=1598766&r1=1598765&r2=1598766&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/FieldGenOrMethodGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/FieldGenOrMethodGen.java Fri May 30 22:51:27 2014
@@ -91,11 +91,11 @@ public abstract class FieldGenOrMethodGe
public void addAttribute( Attribute a ) {
attribute_vec.add(a);
}
-
+
public void addAnnotationEntry(AnnotationEntryGen ag)
- {
- annotation_vec.add(ag);
- }
+ {
+ annotation_vec.add(ag);
+ }
/**
@@ -104,11 +104,11 @@ public abstract class FieldGenOrMethodGe
public void removeAttribute( Attribute a ) {
attribute_vec.remove(a);
}
-
+
public void removeAnnotationEntry(AnnotationEntryGen ag)
- {
- annotation_vec.remove(ag);
- }
+ {
+ annotation_vec.remove(ag);
+ }
/**
@@ -117,11 +117,11 @@ public abstract class FieldGenOrMethodGe
public void removeAttributes() {
attribute_vec.clear();
}
-
+
public void removeAnnotationEntries()
- {
- annotation_vec.clear();
- }
+ {
+ annotation_vec.clear();
+ }
/**
@@ -132,11 +132,11 @@ public abstract class FieldGenOrMethodGe
attribute_vec.toArray(attributes);
return attributes;
}
-
+
public AnnotationEntryGen[] getAnnotationEntries() {
- AnnotationEntryGen[] annotations = new AnnotationEntryGen[annotation_vec.size()];
- annotation_vec.toArray(annotations);
- return annotations;
+ AnnotationEntryGen[] annotations = new AnnotationEntryGen[annotation_vec.size()];
+ annotation_vec.toArray(annotations);
+ return annotations;
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/FieldInstruction.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/FieldInstruction.java?rev=1598766&r1=1598765&r2=1598766&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/FieldInstruction.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/FieldInstruction.java Fri May 30 22:51:27 2014
@@ -59,7 +59,7 @@ public abstract class FieldInstruction e
/** @return size of field (1 or 2)
*/
protected int getFieldSize( ConstantPoolGen cpg ) {
- return Type.size(Type.getTypeSize(getSignature(cpg)));
+ return Type.size(Type.getTypeSize(getSignature(cpg)));
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/INVOKEDYNAMIC.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/INVOKEDYNAMIC.java?rev=1598766&r1=1598765&r2=1598766&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/INVOKEDYNAMIC.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/INVOKEDYNAMIC.java Fri May 30 22:51:27 2014
@@ -72,19 +72,19 @@ public class INVOKEDYNAMIC extends NameS
/**
* Get the ConstantInvokeDynamic associated with this instruction
*/
-
- public ConstantInvokeDynamic getInvokeDynamic( ConstantPoolGen cpg ) {
+
+ public ConstantInvokeDynamic getInvokeDynamic( ConstantPoolGen cpg ) {
ConstantPool cp = cpg.getConstantPool();
return (ConstantInvokeDynamic) cp.getConstant(index);
}
-
+
@Override
- public ConstantNameAndType getNameAndType( ConstantPoolGen cpg ) {
+ public ConstantNameAndType getNameAndType( ConstantPoolGen cpg ) {
ConstantPool cp = cpg.getConstantPool();
ConstantInvokeDynamic id = getInvokeDynamic(cpg);
return (ConstantNameAndType) cp.getConstant(id.getNameAndTypeIndex());
}
-
+
/**
* Also works for instructions whose stack effect depends on the
* constant pool entry they reference.
@@ -136,7 +136,7 @@ public class INVOKEDYNAMIC extends NameS
public Type[] getArgumentTypes( ConstantPoolGen cpg ) {
return Type.getArgumentTypes(getSignature(cpg));
}
-
+
/**
* Read needed data (i.e., index) from file.
*/
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Instruction.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Instruction.java?rev=1598766&r1=1598765&r2=1598766&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Instruction.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Instruction.java Fri May 30 22:51:27 2014
@@ -157,312 +157,312 @@ public abstract class Instruction implem
if (InstructionConstants.INSTRUCTIONS[opcode] != null) {
return InstructionConstants.INSTRUCTIONS[opcode]; // Used predefined immutable object, if available
}
-
+
switch (opcode) {
- case Constants.BIPUSH:
- obj = new BIPUSH();
- break;
- case Constants.SIPUSH:
- obj = new SIPUSH();
- break;
- case Constants.LDC:
- obj = new LDC();
- break;
- case Constants.LDC_W:
- obj = new LDC_W();
- break;
- case Constants.LDC2_W:
- obj = new LDC2_W();
- break;
- case Constants.ILOAD:
- obj = new ILOAD();
- break;
- case Constants.LLOAD:
- obj = new LLOAD();
- break;
- case Constants.FLOAD:
- obj = new FLOAD();
- break;
- case Constants.DLOAD:
- obj = new DLOAD();
- break;
- case Constants.ALOAD:
- obj = new ALOAD();
- break;
- case Constants.ILOAD_0:
- obj = new ILOAD(0);
- break;
- case Constants.ILOAD_1:
- obj = new ILOAD(1);
- break;
- case Constants.ILOAD_2:
- obj = new ILOAD(2);
- break;
- case Constants.ILOAD_3:
- obj = new ILOAD(3);
- break;
- case Constants.LLOAD_0:
- obj = new LLOAD(0);
- break;
- case Constants.LLOAD_1:
- obj = new LLOAD(1);
- break;
- case Constants.LLOAD_2:
- obj = new LLOAD(2);
- break;
- case Constants.LLOAD_3:
- obj = new LLOAD(3);
- break;
- case Constants.FLOAD_0:
- obj = new FLOAD(0);
- break;
- case Constants.FLOAD_1:
- obj = new FLOAD(1);
- break;
- case Constants.FLOAD_2:
- obj = new FLOAD(2);
- break;
- case Constants.FLOAD_3:
- obj = new FLOAD(3);
- break;
- case Constants.DLOAD_0:
- obj = new DLOAD(0);
- break;
- case Constants.DLOAD_1:
- obj = new DLOAD(1);
- break;
- case Constants.DLOAD_2:
- obj = new DLOAD(2);
- break;
- case Constants.DLOAD_3:
- obj = new DLOAD(3);
- break;
- case Constants.ALOAD_0:
- obj = new ALOAD(0);
- break;
- case Constants.ALOAD_1:
- obj = new ALOAD(1);
- break;
- case Constants.ALOAD_2:
- obj = new ALOAD(2);
- break;
- case Constants.ALOAD_3:
- obj = new ALOAD(3);
- break;
- case Constants.ISTORE:
- obj = new ISTORE();
- break;
- case Constants.LSTORE:
- obj = new LSTORE();
- break;
- case Constants.FSTORE:
- obj = new FSTORE();
- break;
- case Constants.DSTORE:
- obj = new DSTORE();
- break;
- case Constants.ASTORE:
- obj = new ASTORE();
- break;
- case Constants.ISTORE_0:
- obj = new ISTORE(0);
- break;
- case Constants.ISTORE_1:
- obj = new ISTORE(1);
- break;
- case Constants.ISTORE_2:
- obj = new ISTORE(2);
- break;
- case Constants.ISTORE_3:
- obj = new ISTORE(3);
- break;
- case Constants.LSTORE_0:
- obj = new LSTORE(0);
- break;
- case Constants.LSTORE_1:
- obj = new LSTORE(1);
- break;
- case Constants.LSTORE_2:
- obj = new LSTORE(2);
- break;
- case Constants.LSTORE_3:
- obj = new LSTORE(3);
- break;
- case Constants.FSTORE_0:
- obj = new FSTORE(0);
- break;
- case Constants.FSTORE_1:
- obj = new FSTORE(1);
- break;
- case Constants.FSTORE_2:
- obj = new FSTORE(2);
- break;
- case Constants.FSTORE_3:
- obj = new FSTORE(3);
- break;
- case Constants.DSTORE_0:
- obj = new DSTORE(0);
- break;
- case Constants.DSTORE_1:
- obj = new DSTORE(1);
- break;
- case Constants.DSTORE_2:
- obj = new DSTORE(2);
- break;
- case Constants.DSTORE_3:
- obj = new DSTORE(3);
- break;
- case Constants.ASTORE_0:
- obj = new ASTORE(0);
- break;
- case Constants.ASTORE_1:
- obj = new ASTORE(1);
- break;
- case Constants.ASTORE_2:
- obj = new ASTORE(2);
- break;
- case Constants.ASTORE_3:
- obj = new ASTORE(3);
- break;
- case Constants.IINC:
- obj = new IINC();
- break;
- case Constants.IFEQ:
- obj = new IFEQ();
- break;
- case Constants.IFNE:
- obj = new IFNE();
- break;
- case Constants.IFLT:
- obj = new IFLT();
- break;
- case Constants.IFGE:
- obj = new IFGE();
- break;
- case Constants.IFGT:
- obj = new IFGT();
- break;
- case Constants.IFLE:
- obj = new IFLE();
- break;
- case Constants.IF_ICMPEQ:
- obj = new IF_ICMPEQ();
- break;
- case Constants.IF_ICMPNE:
- obj = new IF_ICMPNE();
- break;
- case Constants.IF_ICMPLT:
- obj = new IF_ICMPLT();
- break;
- case Constants.IF_ICMPGE:
- obj = new IF_ICMPGE();
- break;
- case Constants.IF_ICMPGT:
- obj = new IF_ICMPGT();
- break;
- case Constants.IF_ICMPLE:
- obj = new IF_ICMPLE();
- break;
- case Constants.IF_ACMPEQ:
- obj = new IF_ACMPEQ();
- break;
- case Constants.IF_ACMPNE:
- obj = new IF_ACMPNE();
- break;
- case Constants.GOTO:
- obj = new GOTO();
- break;
- case Constants.JSR:
- obj = new JSR();
- break;
- case Constants.RET:
- obj = new RET();
- break;
- case Constants.TABLESWITCH:
- obj = new TABLESWITCH();
- break;
- case Constants.LOOKUPSWITCH:
- obj = new LOOKUPSWITCH();
- break;
- case Constants.GETSTATIC:
- obj = new GETSTATIC();
- break;
- case Constants.PUTSTATIC:
- obj = new PUTSTATIC();
- break;
- case Constants.GETFIELD:
- obj = new GETFIELD();
- break;
- case Constants.PUTFIELD:
- obj = new PUTFIELD();
- break;
- case Constants.INVOKEVIRTUAL:
- obj = new INVOKEVIRTUAL();
- break;
- case Constants.INVOKESPECIAL:
- obj = new INVOKESPECIAL();
- break;
- case Constants.INVOKESTATIC:
- obj = new INVOKESTATIC();
- break;
- case Constants.INVOKEINTERFACE:
- obj = new INVOKEINTERFACE();
- break;
- case Constants.INVOKEDYNAMIC:
- obj = new INVOKEDYNAMIC();
- break;
- case Constants.NEW:
- obj = new NEW();
- break;
- case Constants.NEWARRAY:
- obj = new NEWARRAY();
- break;
- case Constants.ANEWARRAY:
- obj = new ANEWARRAY();
- break;
- case Constants.CHECKCAST:
- obj = new CHECKCAST();
- break;
- case Constants.INSTANCEOF:
- obj = new INSTANCEOF();
- break;
- case Constants.MULTIANEWARRAY:
- obj = new MULTIANEWARRAY();
- break;
- case Constants.IFNULL:
- obj = new IFNULL();
- break;
- case Constants.IFNONNULL:
- obj = new IFNONNULL();
- break;
- case Constants.GOTO_W:
- obj = new GOTO_W();
- break;
- case Constants.JSR_W:
- obj = new JSR_W();
- break;
- case Constants.BREAKPOINT:
- obj = new BREAKPOINT();
- break;
- case Constants.IMPDEP1:
- obj = new IMPDEP1();
- break;
- case Constants.IMPDEP2:
- obj = new IMPDEP2();
- break;
- default:
- throw new ClassGenException("Illegal opcode detected: " + opcode);
+ case Constants.BIPUSH:
+ obj = new BIPUSH();
+ break;
+ case Constants.SIPUSH:
+ obj = new SIPUSH();
+ break;
+ case Constants.LDC:
+ obj = new LDC();
+ break;
+ case Constants.LDC_W:
+ obj = new LDC_W();
+ break;
+ case Constants.LDC2_W:
+ obj = new LDC2_W();
+ break;
+ case Constants.ILOAD:
+ obj = new ILOAD();
+ break;
+ case Constants.LLOAD:
+ obj = new LLOAD();
+ break;
+ case Constants.FLOAD:
+ obj = new FLOAD();
+ break;
+ case Constants.DLOAD:
+ obj = new DLOAD();
+ break;
+ case Constants.ALOAD:
+ obj = new ALOAD();
+ break;
+ case Constants.ILOAD_0:
+ obj = new ILOAD(0);
+ break;
+ case Constants.ILOAD_1:
+ obj = new ILOAD(1);
+ break;
+ case Constants.ILOAD_2:
+ obj = new ILOAD(2);
+ break;
+ case Constants.ILOAD_3:
+ obj = new ILOAD(3);
+ break;
+ case Constants.LLOAD_0:
+ obj = new LLOAD(0);
+ break;
+ case Constants.LLOAD_1:
+ obj = new LLOAD(1);
+ break;
+ case Constants.LLOAD_2:
+ obj = new LLOAD(2);
+ break;
+ case Constants.LLOAD_3:
+ obj = new LLOAD(3);
+ break;
+ case Constants.FLOAD_0:
+ obj = new FLOAD(0);
+ break;
+ case Constants.FLOAD_1:
+ obj = new FLOAD(1);
+ break;
+ case Constants.FLOAD_2:
+ obj = new FLOAD(2);
+ break;
+ case Constants.FLOAD_3:
+ obj = new FLOAD(3);
+ break;
+ case Constants.DLOAD_0:
+ obj = new DLOAD(0);
+ break;
+ case Constants.DLOAD_1:
+ obj = new DLOAD(1);
+ break;
+ case Constants.DLOAD_2:
+ obj = new DLOAD(2);
+ break;
+ case Constants.DLOAD_3:
+ obj = new DLOAD(3);
+ break;
+ case Constants.ALOAD_0:
+ obj = new ALOAD(0);
+ break;
+ case Constants.ALOAD_1:
+ obj = new ALOAD(1);
+ break;
+ case Constants.ALOAD_2:
+ obj = new ALOAD(2);
+ break;
+ case Constants.ALOAD_3:
+ obj = new ALOAD(3);
+ break;
+ case Constants.ISTORE:
+ obj = new ISTORE();
+ break;
+ case Constants.LSTORE:
+ obj = new LSTORE();
+ break;
+ case Constants.FSTORE:
+ obj = new FSTORE();
+ break;
+ case Constants.DSTORE:
+ obj = new DSTORE();
+ break;
+ case Constants.ASTORE:
+ obj = new ASTORE();
+ break;
+ case Constants.ISTORE_0:
+ obj = new ISTORE(0);
+ break;
+ case Constants.ISTORE_1:
+ obj = new ISTORE(1);
+ break;
+ case Constants.ISTORE_2:
+ obj = new ISTORE(2);
+ break;
+ case Constants.ISTORE_3:
+ obj = new ISTORE(3);
+ break;
+ case Constants.LSTORE_0:
+ obj = new LSTORE(0);
+ break;
+ case Constants.LSTORE_1:
+ obj = new LSTORE(1);
+ break;
+ case Constants.LSTORE_2:
+ obj = new LSTORE(2);
+ break;
+ case Constants.LSTORE_3:
+ obj = new LSTORE(3);
+ break;
+ case Constants.FSTORE_0:
+ obj = new FSTORE(0);
+ break;
+ case Constants.FSTORE_1:
+ obj = new FSTORE(1);
+ break;
+ case Constants.FSTORE_2:
+ obj = new FSTORE(2);
+ break;
+ case Constants.FSTORE_3:
+ obj = new FSTORE(3);
+ break;
+ case Constants.DSTORE_0:
+ obj = new DSTORE(0);
+ break;
+ case Constants.DSTORE_1:
+ obj = new DSTORE(1);
+ break;
+ case Constants.DSTORE_2:
+ obj = new DSTORE(2);
+ break;
+ case Constants.DSTORE_3:
+ obj = new DSTORE(3);
+ break;
+ case Constants.ASTORE_0:
+ obj = new ASTORE(0);
+ break;
+ case Constants.ASTORE_1:
+ obj = new ASTORE(1);
+ break;
+ case Constants.ASTORE_2:
+ obj = new ASTORE(2);
+ break;
+ case Constants.ASTORE_3:
+ obj = new ASTORE(3);
+ break;
+ case Constants.IINC:
+ obj = new IINC();
+ break;
+ case Constants.IFEQ:
+ obj = new IFEQ();
+ break;
+ case Constants.IFNE:
+ obj = new IFNE();
+ break;
+ case Constants.IFLT:
+ obj = new IFLT();
+ break;
+ case Constants.IFGE:
+ obj = new IFGE();
+ break;
+ case Constants.IFGT:
+ obj = new IFGT();
+ break;
+ case Constants.IFLE:
+ obj = new IFLE();
+ break;
+ case Constants.IF_ICMPEQ:
+ obj = new IF_ICMPEQ();
+ break;
+ case Constants.IF_ICMPNE:
+ obj = new IF_ICMPNE();
+ break;
+ case Constants.IF_ICMPLT:
+ obj = new IF_ICMPLT();
+ break;
+ case Constants.IF_ICMPGE:
+ obj = new IF_ICMPGE();
+ break;
+ case Constants.IF_ICMPGT:
+ obj = new IF_ICMPGT();
+ break;
+ case Constants.IF_ICMPLE:
+ obj = new IF_ICMPLE();
+ break;
+ case Constants.IF_ACMPEQ:
+ obj = new IF_ACMPEQ();
+ break;
+ case Constants.IF_ACMPNE:
+ obj = new IF_ACMPNE();
+ break;
+ case Constants.GOTO:
+ obj = new GOTO();
+ break;
+ case Constants.JSR:
+ obj = new JSR();
+ break;
+ case Constants.RET:
+ obj = new RET();
+ break;
+ case Constants.TABLESWITCH:
+ obj = new TABLESWITCH();
+ break;
+ case Constants.LOOKUPSWITCH:
+ obj = new LOOKUPSWITCH();
+ break;
+ case Constants.GETSTATIC:
+ obj = new GETSTATIC();
+ break;
+ case Constants.PUTSTATIC:
+ obj = new PUTSTATIC();
+ break;
+ case Constants.GETFIELD:
+ obj = new GETFIELD();
+ break;
+ case Constants.PUTFIELD:
+ obj = new PUTFIELD();
+ break;
+ case Constants.INVOKEVIRTUAL:
+ obj = new INVOKEVIRTUAL();
+ break;
+ case Constants.INVOKESPECIAL:
+ obj = new INVOKESPECIAL();
+ break;
+ case Constants.INVOKESTATIC:
+ obj = new INVOKESTATIC();
+ break;
+ case Constants.INVOKEINTERFACE:
+ obj = new INVOKEINTERFACE();
+ break;
+ case Constants.INVOKEDYNAMIC:
+ obj = new INVOKEDYNAMIC();
+ break;
+ case Constants.NEW:
+ obj = new NEW();
+ break;
+ case Constants.NEWARRAY:
+ obj = new NEWARRAY();
+ break;
+ case Constants.ANEWARRAY:
+ obj = new ANEWARRAY();
+ break;
+ case Constants.CHECKCAST:
+ obj = new CHECKCAST();
+ break;
+ case Constants.INSTANCEOF:
+ obj = new INSTANCEOF();
+ break;
+ case Constants.MULTIANEWARRAY:
+ obj = new MULTIANEWARRAY();
+ break;
+ case Constants.IFNULL:
+ obj = new IFNULL();
+ break;
+ case Constants.IFNONNULL:
+ obj = new IFNONNULL();
+ break;
+ case Constants.GOTO_W:
+ obj = new GOTO_W();
+ break;
+ case Constants.JSR_W:
+ obj = new JSR_W();
+ break;
+ case Constants.BREAKPOINT:
+ obj = new BREAKPOINT();
+ break;
+ case Constants.IMPDEP1:
+ obj = new IMPDEP1();
+ break;
+ case Constants.IMPDEP2:
+ obj = new IMPDEP2();
+ break;
+ default:
+ throw new ClassGenException("Illegal opcode detected: " + opcode);
+
+ }
- }
-
if (wide
- && !((obj instanceof LocalVariableInstruction) || (obj instanceof IINC) || (obj instanceof RET))) {
- throw new ClassGenException("Illegal opcode after wide: " + opcode);
- }
- obj.setOpcode(opcode);
- obj.initFromFile(bytes, wide); // Do further initializations, if any
- return obj;
- }
+ && !((obj instanceof LocalVariableInstruction) || (obj instanceof IINC) || (obj instanceof RET))) {
+ throw new ClassGenException("Illegal opcode after wide: " + opcode);
+ }
+ obj.setOpcode(opcode);
+ obj.initFromFile(bytes, wide); // Do further initializations, if any
+ return obj;
+ }
/**
* This method also gives right results for instructions whose
@@ -557,7 +557,7 @@ public abstract class Instruction implem
public boolean equals( Object that ) {
return (that instanceof Instruction) ? cmp.equals(this, (Instruction) that) : false;
}
-
+
/** calculate the hashCode of this object
* @return the hashCode
*/
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java?rev=1598766&r1=1598765&r2=1598766&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java Fri May 30 22:51:27 2014
@@ -31,7 +31,7 @@ import org.apache.bcel.Constants;
*/
public class InstructionFactory implements InstructionConstants, java.io.Serializable {
- private static final long serialVersionUID = -1210011499635580258L;
+ private static final long serialVersionUID = -1210011499635580258L;
private static final String[] short_names = {
"C", "F", "D", "B", "S", "I", "L"
@@ -354,7 +354,7 @@ public class InstructionFactory implemen
case '/':
return FDIV;
case '%':
- return FREM;
+ return FREM;
default:
throw new RuntimeException("Invalid operand " + op);
}
@@ -372,7 +372,7 @@ public class InstructionFactory implemen
case '/':
return DDIV;
case '%':
- return DREM;
+ return DREM;
default:
throw new RuntimeException("Invalid operand " + op);
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionList.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionList.java?rev=1598766&r1=1598765&r2=1598766&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionList.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionList.java Fri May 30 22:51:27 2014
@@ -142,7 +142,7 @@ public class InstructionList implements
* @return target position's instruction handle if available
*/
public InstructionHandle findHandle( int pos ) {
- int[] positions = byte_positions;
+ int[] positions = byte_positions;
InstructionHandle ih = start;
for (int i = 0; i < length; i++) {
if(positions[i] == pos) {
@@ -1005,7 +1005,7 @@ public class InstructionList implements
public InstructionHandle next() throws NoSuchElementException {
- if (ih == null) {
+ if (ih == null) {
throw new NoSuchElementException();
}
InstructionHandle i = ih;
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InvokeInstruction.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InvokeInstruction.java?rev=1598766&r1=1598765&r2=1598766&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InvokeInstruction.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InvokeInstruction.java Fri May 30 22:51:27 2014
@@ -75,7 +75,7 @@ public abstract class InvokeInstruction
} else {
sum = 1; // this reference
}
-
+
String signature = getSignature(cpg);
sum += Type.getArgumentTypesSize(signature);
return sum;
@@ -89,8 +89,8 @@ public abstract class InvokeInstruction
*/
@Override
public int produceStack( ConstantPoolGen cpg ) {
- String signature = getSignature(cpg);
- return Type.getReturnTypeSize(signature);
+ String signature = getSignature(cpg);
+ return Type.getReturnTypeSize(signature);
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/JsrInstruction.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/JsrInstruction.java?rev=1598766&r1=1598765&r2=1598766&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/JsrInstruction.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/JsrInstruction.java Fri May 30 22:51:27 2014
@@ -77,7 +77,7 @@ public abstract class JsrInstruction ext
throw new RuntimeException("physicalSuccessor() called on a shared JsrInstruction.");
}
}
- // Return the physical successor
+ // Return the physical successor
return toThis.getNext();
}
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/LDC.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/LDC.java?rev=1598766&r1=1598765&r2=1598766&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/LDC.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/LDC.java Fri May 30 22:51:27 2014
@@ -108,9 +108,9 @@ public class LDC extends CPInstruction i
case org.apache.bcel.Constants.CONSTANT_Integer:
return Integer.valueOf(((org.apache.bcel.classfile.ConstantInteger) c).getBytes());
case org.apache.bcel.Constants.CONSTANT_Class:
- int nameIndex = ((org.apache.bcel.classfile.ConstantClass) c).getNameIndex();
- c = cpg.getConstantPool().getConstant(nameIndex);
- return new ObjectType(((org.apache.bcel.classfile.ConstantUtf8) c).getBytes());
+ int nameIndex = ((org.apache.bcel.classfile.ConstantClass) c).getNameIndex();
+ c = cpg.getConstantPool().getConstant(nameIndex);
+ return new ObjectType(((org.apache.bcel.classfile.ConstantUtf8) c).getBytes());
default: // Never reached
throw new RuntimeException("Unknown or invalid constant type at " + index);
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java?rev=1598766&r1=1598765&r2=1598766&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java Fri May 30 22:51:27 2014
@@ -74,11 +74,11 @@ public class MethodGen extends FieldGenO
private List<CodeExceptionGen> exception_vec = new ArrayList<CodeExceptionGen>();
private List<String> throws_vec = new ArrayList<String>();
private List<Attribute> code_attrs_vec = new ArrayList<Attribute>();
-
+
private List<AnnotationEntryGen>[] param_annotations; // Array of lists containing AnnotationGen objects
private boolean hasParameterAnnotations = false;
private boolean haveUnpackedParameterAnnotations = false;
-
+
private static BCELComparator _cmp = new BCELComparator() {
public boolean equals( Object o1, Object o2 ) {
@@ -265,11 +265,11 @@ public class MethodGen extends FieldGenO
addException(name2);
}
} else if (a instanceof Annotations) {
- Annotations runtimeAnnotations = (Annotations) a;
- AnnotationEntry[] aes = runtimeAnnotations.getAnnotationEntries();
- for (AnnotationEntry element : aes) {
- addAnnotationEntry(new AnnotationEntryGen(element, cp, false));
- }
+ Annotations runtimeAnnotations = (Annotations) a;
+ AnnotationEntry[] aes = runtimeAnnotations.getAnnotationEntries();
+ for (AnnotationEntry element : aes) {
+ addAnnotationEntry(new AnnotationEntryGen(element, cp, false));
+ }
} else {
addAttribute(a);
}
@@ -603,24 +603,24 @@ public class MethodGen extends FieldGenO
code_attrs_vec.toArray(attributes);
return attributes;
}
-
+
public void addAnnotationsAsAttribute(ConstantPoolGen cp) {
- Attribute[] attrs = Utility.getAnnotationAttributes(cp,annotation_vec);
+ Attribute[] attrs = Utility.getAnnotationAttributes(cp,annotation_vec);
for (Attribute attr : attrs) {
- addAttribute(attr);
- }
+ addAttribute(attr);
+ }
}
-
+
public void addParameterAnnotationsAsAttribute(ConstantPoolGen cp) {
- if (!hasParameterAnnotations) {
+ if (!hasParameterAnnotations) {
return;
}
- Attribute[] attrs = Utility.getParameterAnnotationAttributes(cp,param_annotations);
- if (attrs!=null) {
+ Attribute[] attrs = Utility.getParameterAnnotationAttributes(cp,param_annotations);
+ if (attrs!=null) {
for (Attribute attr : attrs) {
- addAttribute(attr);
- }
- }
+ addAttribute(attr);
+ }
+ }
}
@@ -1059,7 +1059,7 @@ public class MethodGen extends FieldGenO
buf.append(" [").append(a.toString()).append("]");
}
}
-
+
if (throws_vec.size() > 0) {
for (String throwsDescriptor : throws_vec) {
buf.append("\n\t\tthrows ").append(throwsDescriptor);
@@ -1080,114 +1080,114 @@ public class MethodGen extends FieldGenO
}
return mg;
}
-
+
//J5TODO: Should param_annotations be an array of arrays? Rather than an array of lists, this
// is more likely to suggest to the caller it is readonly (which a List does not).
/**
* Return a list of AnnotationGen objects representing parameter annotations
*/
public List<AnnotationEntryGen> getAnnotationsOnParameter(int i) {
- ensureExistingParameterAnnotationsUnpacked();
- if (!hasParameterAnnotations || i>arg_types.length) {
+ ensureExistingParameterAnnotationsUnpacked();
+ if (!hasParameterAnnotations || i>arg_types.length) {
return null;
}
- return param_annotations[i];
+ return param_annotations[i];
}
-
+
/**
- * Goes through the attributes on the method and identifies any that are
- * RuntimeParameterAnnotations, extracting their contents and storing them
- * as parameter annotations. There are two kinds of parameter annotation -
- * visible and invisible. Once they have been unpacked, these attributes are
- * deleted. (The annotations will be rebuilt as attributes when someone
- * builds a Method object out of this MethodGen object).
- */
- private void ensureExistingParameterAnnotationsUnpacked()
- {
- if (haveUnpackedParameterAnnotations) {
+ * Goes through the attributes on the method and identifies any that are
+ * RuntimeParameterAnnotations, extracting their contents and storing them
+ * as parameter annotations. There are two kinds of parameter annotation -
+ * visible and invisible. Once they have been unpacked, these attributes are
+ * deleted. (The annotations will be rebuilt as attributes when someone
+ * builds a Method object out of this MethodGen object).
+ */
+ private void ensureExistingParameterAnnotationsUnpacked()
+ {
+ if (haveUnpackedParameterAnnotations) {
return;
}
- // Find attributes that contain parameter annotation data
- Attribute[] attrs = getAttributes();
- ParameterAnnotations paramAnnVisAttr = null;
- ParameterAnnotations paramAnnInvisAttr = null;
- for (Attribute attribute : attrs) {
- if (attribute instanceof ParameterAnnotations)
- {
- // Initialize param_annotations
- if (!hasParameterAnnotations)
- {
- param_annotations = new List[arg_types.length];
- for (int j = 0; j < arg_types.length; j++) {
+ // Find attributes that contain parameter annotation data
+ Attribute[] attrs = getAttributes();
+ ParameterAnnotations paramAnnVisAttr = null;
+ ParameterAnnotations paramAnnInvisAttr = null;
+ for (Attribute attribute : attrs) {
+ if (attribute instanceof ParameterAnnotations)
+ {
+ // Initialize param_annotations
+ if (!hasParameterAnnotations)
+ {
+ param_annotations = new List[arg_types.length];
+ for (int j = 0; j < arg_types.length; j++) {
param_annotations[j] = new ArrayList<AnnotationEntryGen>();
}
- }
- hasParameterAnnotations = true;
- ParameterAnnotations rpa = (ParameterAnnotations) attribute;
- if (rpa instanceof RuntimeVisibleParameterAnnotations) {
+ }
+ hasParameterAnnotations = true;
+ ParameterAnnotations rpa = (ParameterAnnotations) attribute;
+ if (rpa instanceof RuntimeVisibleParameterAnnotations) {
paramAnnVisAttr = rpa;
} else {
paramAnnInvisAttr = rpa;
}
- for (int j = 0; j < arg_types.length; j++)
- {
- // This returns Annotation[] ...
- ParameterAnnotationEntry immutableArray = rpa
- .getParameterAnnotationEntries()[j];
- // ... which needs transforming into an AnnotationGen[] ...
- List<AnnotationEntryGen> mutable = makeMutableVersion(immutableArray.getAnnotationEntries());
- // ... then add these to any we already know about
- param_annotations[j].addAll(mutable);
- }
- }
- }
- if (paramAnnVisAttr != null) {
+ for (int j = 0; j < arg_types.length; j++)
+ {
+ // This returns Annotation[] ...
+ ParameterAnnotationEntry immutableArray = rpa
+ .getParameterAnnotationEntries()[j];
+ // ... which needs transforming into an AnnotationGen[] ...
+ List<AnnotationEntryGen> mutable = makeMutableVersion(immutableArray.getAnnotationEntries());
+ // ... then add these to any we already know about
+ param_annotations[j].addAll(mutable);
+ }
+ }
+ }
+ if (paramAnnVisAttr != null) {
removeAttribute(paramAnnVisAttr);
}
- if (paramAnnInvisAttr != null) {
+ if (paramAnnInvisAttr != null) {
removeAttribute(paramAnnInvisAttr);
}
- haveUnpackedParameterAnnotations = true;
- }
+ haveUnpackedParameterAnnotations = true;
+ }
- private List<AnnotationEntryGen> makeMutableVersion(AnnotationEntry[] mutableArray)
- {
- List<AnnotationEntryGen> result = new ArrayList<AnnotationEntryGen>();
- for (AnnotationEntry element : mutableArray) {
- result.add(new AnnotationEntryGen(element, getConstantPool(),
- false));
- }
- return result;
- }
-
- public void addParameterAnnotation(int parameterIndex,
- AnnotationEntryGen annotation)
- {
- ensureExistingParameterAnnotationsUnpacked();
- if (!hasParameterAnnotations)
- {
- param_annotations = new List[arg_types.length];
- hasParameterAnnotations = true;
- }
- List<AnnotationEntryGen> existingAnnotations = param_annotations[parameterIndex];
- if (existingAnnotations != null)
- {
- existingAnnotations.add(annotation);
- }
- else
- {
- List<AnnotationEntryGen> l = new ArrayList<AnnotationEntryGen>();
- l.add(annotation);
- param_annotations[parameterIndex] = l;
- }
- }
+ private List<AnnotationEntryGen> makeMutableVersion(AnnotationEntry[] mutableArray)
+ {
+ List<AnnotationEntryGen> result = new ArrayList<AnnotationEntryGen>();
+ for (AnnotationEntry element : mutableArray) {
+ result.add(new AnnotationEntryGen(element, getConstantPool(),
+ false));
+ }
+ return result;
+ }
+
+ public void addParameterAnnotation(int parameterIndex,
+ AnnotationEntryGen annotation)
+ {
+ ensureExistingParameterAnnotationsUnpacked();
+ if (!hasParameterAnnotations)
+ {
+ param_annotations = new List[arg_types.length];
+ hasParameterAnnotations = true;
+ }
+ List<AnnotationEntryGen> existingAnnotations = param_annotations[parameterIndex];
+ if (existingAnnotations != null)
+ {
+ existingAnnotations.add(annotation);
+ }
+ else
+ {
+ List<AnnotationEntryGen> l = new ArrayList<AnnotationEntryGen>();
+ l.add(annotation);
+ param_annotations[parameterIndex] = l;
+ }
+ }
/**
- * @return Comparison strategy object
- */
+ * @return Comparison strategy object
+ */
public static BCELComparator getComparator() {
return _cmp;
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/NameSignatureInstruction.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/NameSignatureInstruction.java?rev=1598766&r1=1598765&r2=1598766&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/NameSignatureInstruction.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/NameSignatureInstruction.java Fri May 30 22:51:27 2014
@@ -14,35 +14,35 @@ import org.apache.bcel.classfile.Constan
*/
public abstract class NameSignatureInstruction extends CPInstruction {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- public NameSignatureInstruction() {
- super();
- }
-
- public NameSignatureInstruction(short opcode, int index) {
- super(opcode, index);
- }
-
- public ConstantNameAndType getNameAndType(ConstantPoolGen cpg) {
- ConstantPool cp = cpg.getConstantPool();
- ConstantCP cmr = (ConstantCP) cp.getConstant(index);
- return (ConstantNameAndType) cp.getConstant(cmr.getNameAndTypeIndex());
- }
- /** @return signature of referenced method/field.
- */
- public String getSignature(ConstantPoolGen cpg) {
- ConstantPool cp = cpg.getConstantPool();
- ConstantNameAndType cnat = getNameAndType(cpg);
- return ((ConstantUtf8) cp.getConstant(cnat.getSignatureIndex())).getBytes();
- }
-
- /** @return name of referenced method/field.
- */
- public String getName(ConstantPoolGen cpg) {
- ConstantPool cp = cpg.getConstantPool();
- ConstantNameAndType cnat = getNameAndType(cpg);
- return ((ConstantUtf8) cp.getConstant(cnat.getNameIndex())).getBytes();
- }
+ public NameSignatureInstruction() {
+ super();
+ }
+
+ public NameSignatureInstruction(short opcode, int index) {
+ super(opcode, index);
+ }
+
+ public ConstantNameAndType getNameAndType(ConstantPoolGen cpg) {
+ ConstantPool cp = cpg.getConstantPool();
+ ConstantCP cmr = (ConstantCP) cp.getConstant(index);
+ return (ConstantNameAndType) cp.getConstant(cmr.getNameAndTypeIndex());
+ }
+ /** @return signature of referenced method/field.
+ */
+ public String getSignature(ConstantPoolGen cpg) {
+ ConstantPool cp = cpg.getConstantPool();
+ ConstantNameAndType cnat = getNameAndType(cpg);
+ return ((ConstantUtf8) cp.getConstant(cnat.getSignatureIndex())).getBytes();
+ }
+
+ /** @return name of referenced method/field.
+ */
+ public String getName(ConstantPoolGen cpg) {
+ ConstantPool cp = cpg.getConstantPool();
+ ConstantNameAndType cnat = getNameAndType(cpg);
+ return ((ConstantUtf8) cp.getConstant(cnat.getNameIndex())).getBytes();
+ }
}
\ No newline at end of file
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/SimpleElementValueGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/SimpleElementValueGen.java?rev=1598766&r1=1598765&r2=1598766&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/SimpleElementValueGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/SimpleElementValueGen.java Fri May 30 22:51:27 2014
@@ -29,241 +29,241 @@ import org.apache.bcel.classfile.SimpleE
public class SimpleElementValueGen extends ElementValueGen
{
- // For primitive types and string type, this points to the value entry in
- // the cpGen
- // For 'class' this points to the class entry in the cpGen
- private int idx;
-
- // ctors for each supported type... type could be inferred but for now lets
- // force it to be passed
- /**
- * Protected ctor used for deserialization, doesn't *put* an entry in the
- * constant pool, assumes the one at the supplied index is correct.
- */
- protected SimpleElementValueGen(int type, int idx, ConstantPoolGen cpGen)
- {
- super(type, cpGen);
- this.idx = idx;
- }
-
- public SimpleElementValueGen(int type, ConstantPoolGen cpGen, int value)
- {
- super(type, cpGen);
- idx = cpGen.addInteger(value);
- }
-
- public SimpleElementValueGen(int type, ConstantPoolGen cpGen, long value)
- {
- super(type, cpGen);
- idx = cpGen.addLong(value);
- }
-
- public SimpleElementValueGen(int type, ConstantPoolGen cpGen, double value)
- {
- super(type, cpGen);
- idx = cpGen.addDouble(value);
- }
-
- public SimpleElementValueGen(int type, ConstantPoolGen cpGen, float value)
- {
- super(type, cpGen);
- idx = cpGen.addFloat(value);
- }
-
- public SimpleElementValueGen(int type, ConstantPoolGen cpGen, short value)
- {
- super(type, cpGen);
- idx = cpGen.addInteger(value);
- }
-
- public SimpleElementValueGen(int type, ConstantPoolGen cpGen, byte value)
- {
- super(type, cpGen);
- idx = cpGen.addInteger(value);
- }
-
- public SimpleElementValueGen(int type, ConstantPoolGen cpGen, char value)
- {
- super(type, cpGen);
- idx = cpGen.addInteger(value);
- }
-
- public SimpleElementValueGen(int type, ConstantPoolGen cpGen, boolean value)
- {
- super(type, cpGen);
- if (value) {
+ // For primitive types and string type, this points to the value entry in
+ // the cpGen
+ // For 'class' this points to the class entry in the cpGen
+ private int idx;
+
+ // ctors for each supported type... type could be inferred but for now lets
+ // force it to be passed
+ /**
+ * Protected ctor used for deserialization, doesn't *put* an entry in the
+ * constant pool, assumes the one at the supplied index is correct.
+ */
+ protected SimpleElementValueGen(int type, int idx, ConstantPoolGen cpGen)
+ {
+ super(type, cpGen);
+ this.idx = idx;
+ }
+
+ public SimpleElementValueGen(int type, ConstantPoolGen cpGen, int value)
+ {
+ super(type, cpGen);
+ idx = cpGen.addInteger(value);
+ }
+
+ public SimpleElementValueGen(int type, ConstantPoolGen cpGen, long value)
+ {
+ super(type, cpGen);
+ idx = cpGen.addLong(value);
+ }
+
+ public SimpleElementValueGen(int type, ConstantPoolGen cpGen, double value)
+ {
+ super(type, cpGen);
+ idx = cpGen.addDouble(value);
+ }
+
+ public SimpleElementValueGen(int type, ConstantPoolGen cpGen, float value)
+ {
+ super(type, cpGen);
+ idx = cpGen.addFloat(value);
+ }
+
+ public SimpleElementValueGen(int type, ConstantPoolGen cpGen, short value)
+ {
+ super(type, cpGen);
+ idx = cpGen.addInteger(value);
+ }
+
+ public SimpleElementValueGen(int type, ConstantPoolGen cpGen, byte value)
+ {
+ super(type, cpGen);
+ idx = cpGen.addInteger(value);
+ }
+
+ public SimpleElementValueGen(int type, ConstantPoolGen cpGen, char value)
+ {
+ super(type, cpGen);
+ idx = cpGen.addInteger(value);
+ }
+
+ public SimpleElementValueGen(int type, ConstantPoolGen cpGen, boolean value)
+ {
+ super(type, cpGen);
+ if (value) {
idx = cpGen.addInteger(1);
} else {
idx = cpGen.addInteger(0);
}
- }
+ }
- public SimpleElementValueGen(int type, ConstantPoolGen cpGen, String value)
- {
- super(type, cpGen);
- idx = cpGen.addUtf8(value);
- }
-
- /**
- * The boolean controls whether we copy info from the 'old' constant pool to
- * the 'new'. You need to use this ctor if the annotation is being copied
- * from one file to another.
- */
- public SimpleElementValueGen(SimpleElementValue value,
- ConstantPoolGen cpool, boolean copyPoolEntries)
- {
- super(value.getElementValueType(), cpool);
- if (!copyPoolEntries)
- {
- // J5ASSERT: Could assert value.stringifyValue() is the same as
- // cpool.getConstant(SimpleElementValuevalue.getIndex())
- idx = value.getIndex();
- }
- else
- {
- switch (value.getElementValueType())
- {
- case STRING:
- idx = cpool.addUtf8(value.getValueString());
- break;
- case PRIMITIVE_INT:
- idx = cpool.addInteger(value.getValueInt());
- break;
- case PRIMITIVE_BYTE:
- idx = cpool.addInteger(value.getValueByte());
- break;
- case PRIMITIVE_CHAR:
- idx = cpool.addInteger(value.getValueChar());
- break;
- case PRIMITIVE_LONG:
- idx = cpool.addLong(value.getValueLong());
- break;
- case PRIMITIVE_FLOAT:
- idx = cpool.addFloat(value.getValueFloat());
- break;
- case PRIMITIVE_DOUBLE:
- idx = cpool.addDouble(value.getValueDouble());
- break;
- case PRIMITIVE_BOOLEAN:
- if (value.getValueBoolean())
- {
- idx = cpool.addInteger(1);
- }
- else
- {
- idx = cpool.addInteger(0);
- }
- break;
- case PRIMITIVE_SHORT:
- idx = cpool.addInteger(value.getValueShort());
- break;
- default:
- throw new RuntimeException(
- "SimpleElementValueGen class does not know how "
- + "to copy this type " + type);
- }
- }
- }
-
- /**
- * Return immutable variant
- */
- @Override
+ public SimpleElementValueGen(int type, ConstantPoolGen cpGen, String value)
+ {
+ super(type, cpGen);
+ idx = cpGen.addUtf8(value);
+ }
+
+ /**
+ * The boolean controls whether we copy info from the 'old' constant pool to
+ * the 'new'. You need to use this ctor if the annotation is being copied
+ * from one file to another.
+ */
+ public SimpleElementValueGen(SimpleElementValue value,
+ ConstantPoolGen cpool, boolean copyPoolEntries)
+ {
+ super(value.getElementValueType(), cpool);
+ if (!copyPoolEntries)
+ {
+ // J5ASSERT: Could assert value.stringifyValue() is the same as
+ // cpool.getConstant(SimpleElementValuevalue.getIndex())
+ idx = value.getIndex();
+ }
+ else
+ {
+ switch (value.getElementValueType())
+ {
+ case STRING:
+ idx = cpool.addUtf8(value.getValueString());
+ break;
+ case PRIMITIVE_INT:
+ idx = cpool.addInteger(value.getValueInt());
+ break;
+ case PRIMITIVE_BYTE:
+ idx = cpool.addInteger(value.getValueByte());
+ break;
+ case PRIMITIVE_CHAR:
+ idx = cpool.addInteger(value.getValueChar());
+ break;
+ case PRIMITIVE_LONG:
+ idx = cpool.addLong(value.getValueLong());
+ break;
+ case PRIMITIVE_FLOAT:
+ idx = cpool.addFloat(value.getValueFloat());
+ break;
+ case PRIMITIVE_DOUBLE:
+ idx = cpool.addDouble(value.getValueDouble());
+ break;
+ case PRIMITIVE_BOOLEAN:
+ if (value.getValueBoolean())
+ {
+ idx = cpool.addInteger(1);
+ }
+ else
+ {
+ idx = cpool.addInteger(0);
+ }
+ break;
+ case PRIMITIVE_SHORT:
+ idx = cpool.addInteger(value.getValueShort());
+ break;
+ default:
+ throw new RuntimeException(
+ "SimpleElementValueGen class does not know how "
+ + "to copy this type " + type);
+ }
+ }
+ }
+
+ /**
+ * Return immutable variant
+ */
+ @Override
public ElementValue getElementValue()
- {
- return new SimpleElementValue(type, idx, cpGen.getConstantPool());
- }
-
- public int getIndex()
- {
- return idx;
- }
-
- public String getValueString()
- {
- if (type != STRING) {
+ {
+ return new SimpleElementValue(type, idx, cpGen.getConstantPool());
+ }
+
+ public int getIndex()
+ {
+ return idx;
+ }
+
+ public String getValueString()
+ {
+ if (type != STRING) {
throw new RuntimeException(
- "Dont call getValueString() on a non STRING ElementValue");
+ "Dont call getValueString() on a non STRING ElementValue");
}
- ConstantUtf8 c = (ConstantUtf8) cpGen.getConstant(idx);
- return c.getBytes();
- }
-
- public int getValueInt()
- {
- if (type != PRIMITIVE_INT) {
+ ConstantUtf8 c = (ConstantUtf8) cpGen.getConstant(idx);
+ return c.getBytes();
+ }
+
+ public int getValueInt()
+ {
+ if (type != PRIMITIVE_INT) {
throw new RuntimeException(
- "Dont call getValueString() on a non STRING ElementValue");
+ "Dont call getValueString() on a non STRING ElementValue");
}
- ConstantInteger c = (ConstantInteger) cpGen.getConstant(idx);
- return c.getBytes();
- }
+ ConstantInteger c = (ConstantInteger) cpGen.getConstant(idx);
+ return c.getBytes();
+ }
- // Whatever kind of value it is, return it as a string
- @Override
+ // Whatever kind of value it is, return it as a string
+ @Override
public String stringifyValue()
- {
- switch (type)
- {
- case PRIMITIVE_INT:
- ConstantInteger c = (ConstantInteger) cpGen.getConstant(idx);
- return Integer.toString(c.getBytes());
- case PRIMITIVE_LONG:
- ConstantLong j = (ConstantLong) cpGen.getConstant(idx);
- return Long.toString(j.getBytes());
- case PRIMITIVE_DOUBLE:
- ConstantDouble d = (ConstantDouble) cpGen.getConstant(idx);
- return Double.toString(d.getBytes());
- case PRIMITIVE_FLOAT:
- ConstantFloat f = (ConstantFloat) cpGen.getConstant(idx);
- return Float.toString(f.getBytes());
- case PRIMITIVE_SHORT:
- ConstantInteger s = (ConstantInteger) cpGen.getConstant(idx);
- return Integer.toString(s.getBytes());
- case PRIMITIVE_BYTE:
- ConstantInteger b = (ConstantInteger) cpGen.getConstant(idx);
- return Integer.toString(b.getBytes());
- case PRIMITIVE_CHAR:
- ConstantInteger ch = (ConstantInteger) cpGen.getConstant(idx);
- return Integer.toString(ch.getBytes());
- case PRIMITIVE_BOOLEAN:
- ConstantInteger bo = (ConstantInteger) cpGen.getConstant(idx);
- if (bo.getBytes() == 0) {
+ {
+ switch (type)
+ {
+ case PRIMITIVE_INT:
+ ConstantInteger c = (ConstantInteger) cpGen.getConstant(idx);
+ return Integer.toString(c.getBytes());
+ case PRIMITIVE_LONG:
+ ConstantLong j = (ConstantLong) cpGen.getConstant(idx);
+ return Long.toString(j.getBytes());
+ case PRIMITIVE_DOUBLE:
+ ConstantDouble d = (ConstantDouble) cpGen.getConstant(idx);
+ return Double.toString(d.getBytes());
+ case PRIMITIVE_FLOAT:
+ ConstantFloat f = (ConstantFloat) cpGen.getConstant(idx);
+ return Float.toString(f.getBytes());
+ case PRIMITIVE_SHORT:
+ ConstantInteger s = (ConstantInteger) cpGen.getConstant(idx);
+ return Integer.toString(s.getBytes());
+ case PRIMITIVE_BYTE:
+ ConstantInteger b = (ConstantInteger) cpGen.getConstant(idx);
+ return Integer.toString(b.getBytes());
+ case PRIMITIVE_CHAR:
+ ConstantInteger ch = (ConstantInteger) cpGen.getConstant(idx);
+ return Integer.toString(ch.getBytes());
+ case PRIMITIVE_BOOLEAN:
+ ConstantInteger bo = (ConstantInteger) cpGen.getConstant(idx);
+ if (bo.getBytes() == 0) {
return "false";
} else {
return "true";
}
- case STRING:
- ConstantUtf8 cu8 = (ConstantUtf8) cpGen.getConstant(idx);
- return cu8.getBytes();
- default:
- throw new RuntimeException(
- "SimpleElementValueGen class does not know how to stringify type "
- + type);
- }
- }
+ case STRING:
+ ConstantUtf8 cu8 = (ConstantUtf8) cpGen.getConstant(idx);
+ return cu8.getBytes();
+ default:
+ throw new RuntimeException(
+ "SimpleElementValueGen class does not know how to stringify type "
+ + type);
+ }
+ }
- @Override
+ @Override
public void dump(DataOutputStream dos) throws IOException
- {
- dos.writeByte(type); // u1 kind of value
- switch (type)
- {
- case PRIMITIVE_INT:
- case PRIMITIVE_BYTE:
- case PRIMITIVE_CHAR:
- case PRIMITIVE_FLOAT:
- case PRIMITIVE_LONG:
- case PRIMITIVE_BOOLEAN:
- case PRIMITIVE_SHORT:
- case PRIMITIVE_DOUBLE:
- case STRING:
- dos.writeShort(idx);
- break;
- default:
- throw new RuntimeException(
- "SimpleElementValueGen doesnt know how to write out type "
- + type);
- }
- }
+ {
+ dos.writeByte(type); // u1 kind of value
+ switch (type)
+ {
+ case PRIMITIVE_INT:
+ case PRIMITIVE_BYTE:
+ case PRIMITIVE_CHAR:
+ case PRIMITIVE_FLOAT:
+ case PRIMITIVE_LONG:
+ case PRIMITIVE_BOOLEAN:
+ case PRIMITIVE_SHORT:
+ case PRIMITIVE_DOUBLE:
+ case STRING:
+ dos.writeShort(idx);
+ break;
+ default:
+ throw new RuntimeException(
+ "SimpleElementValueGen doesnt know how to write out type "
+ + type);
+ }
+ }
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/TargetLostException.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/TargetLostException.java?rev=1598766&r1=1598765&r2=1598766&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/TargetLostException.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/TargetLostException.java Fri May 30 22:51:27 2014
@@ -30,14 +30,14 @@ package org.apache.bcel.generic;
* <PRE>
* ...
* try {
- * il.delete(start_ih, end_ih);
+ * il.delete(start_ih, end_ih);
* } catch(TargetLostException e) {
* InstructionHandle[] targets = e.getTargets();
- * for(int i=0; i < targets.length; i++) {
- * InstructionTargeter[] targeters = targets[i].getTargeters();
+ * for(int i=0; i < targets.length; i++) {
+ * InstructionTargeter[] targeters = targets[i].getTargeters();
*
- * for(int j=0; j < targeters.length; j++)
- * targeters[j].updateTarget(targets[i], new_target);
+ * for(int j=0; j < targeters.length; j++)
+ * targeters[j].updateTarget(targets[i], new_target);
* }
* }
* </PRE>