aboutsummaryrefslogtreecommitdiffstats
path: root/bcel-builder/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'bcel-builder/src/main/java/org')
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java2
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ConstantPool.java22
2 files changed, 22 insertions, 2 deletions
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java
index 3c1c12daf..6c2240b9d 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java
@@ -185,7 +185,7 @@ public interface Constants {
String[] CONSTANT_NAMES = { "", "CONSTANT_Utf8", "", "CONSTANT_Integer", "CONSTANT_Float", "CONSTANT_Long",
"CONSTANT_Double", "CONSTANT_Class", "CONSTANT_String", "CONSTANT_Fieldref", "CONSTANT_Methodref",
- "CONSTANT_InterfaceMethodref", "CONSTANT_NameAndType","","","CONSTANT_MethodHandle","CONSTANT_MethodType","","CONSTANT_InvokeDynamic",
+ "CONSTANT_InterfaceMethodref", "CONSTANT_NameAndType","","","CONSTANT_MethodHandle","CONSTANT_MethodType","CONSTANT_Dynamic","CONSTANT_InvokeDynamic",
// J9:
"CONSTANT_Module", "CONSTANT_Package"};
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ConstantPool.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ConstantPool.java
index 2066b4569..f8894def4 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ConstantPool.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ConstantPool.java
@@ -212,6 +212,10 @@ public class ConstantPool implements Node {
ConstantInvokeDynamic cID = ((ConstantInvokeDynamic)c);
return "#"+cID.getBootstrapMethodAttrIndex()+"."+constantToString(cID.getNameAndTypeIndex(), Constants.CONSTANT_NameAndType);
+ case Constants.CONSTANT_Dynamic:
+ ConstantDynamic cD = ((ConstantDynamic)c);
+ return "#"+cD.getBootstrapMethodAttrIndex()+"."+constantToString(cD.getNameAndTypeIndex(), Constants.CONSTANT_NameAndType);
+
case Constants.CONSTANT_MethodHandle:
ConstantMethodHandle cMH = ((ConstantMethodHandle)c);
return cMH.getReferenceKind()+":"+constantToString(cMH.getReferenceIndex(),Constants.CONSTANT_Methodref);
@@ -326,7 +330,7 @@ public class ConstantPool implements Node {
StringBuilder buf = new StringBuilder();
for (int i = 1; i < poolSize; i++)
- buf.append(i + ")" + pool[i] + "\n");
+ buf.append(i).append(") ").append(pool[i]).append("\n");
return buf.toString();
}
@@ -632,6 +636,16 @@ public class ConstantPool implements Node {
return addInvokeDynamic(index1,index2);
}
+ case Constants.CONSTANT_Dynamic: {
+ ConstantDynamic cd = (ConstantDynamic)c;
+ int index1 = cd.getBootstrapMethodAttrIndex();
+ ConstantNameAndType cnat = (ConstantNameAndType)constants[cd.getNameAndTypeIndex()];
+ ConstantUtf8 name = (ConstantUtf8) constants[cnat.getNameIndex()];
+ ConstantUtf8 signature = (ConstantUtf8) constants[cnat.getSignatureIndex()];
+ int index2 = addNameAndType(name.getValue(), signature.getValue());
+ return addConstantDynamic(index1,index2);
+ }
+
case Constants.CONSTANT_MethodHandle:
ConstantMethodHandle cmh = (ConstantMethodHandle)c;
return addMethodHandle(cmh.getReferenceKind(),addConstant(constants[cmh.getReferenceIndex()],cp));
@@ -725,6 +739,12 @@ public class ConstantPool implements Node {
pool[poolSize++] = new ConstantInvokeDynamic(bootstrapMethodIndex, constantNameAndTypeIndex);
return ret;
}
+ public int addConstantDynamic(int bootstrapMethodIndex, int constantNameAndTypeIndex) {
+ adjustSize();
+ int ret = poolSize;
+ pool[poolSize++] = new ConstantDynamic(bootstrapMethodIndex, constantNameAndTypeIndex);
+ return ret;
+ }
public int addInterfaceMethodref(String class_name, String method_name, String signature) {
int ret = lookupInterfaceMethodref(class_name, method_name, signature);