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"};
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);
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();
}
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));
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);
*
* @see DescendingVisitor
* @version $Id: EmptyClassVisitor.java,v 1.3 2009/09/15 19:40:22 aclement Exp $
- *
+ *
*/
public class EmptyClassVisitor implements ClassVisitor {
protected EmptyClassVisitor() { }
@Override
public void visitConstantInvokeDynamic(ConstantInvokeDynamic obj) {}
@Override
+public void visitConstantDynamic(ConstantDynamic obj) {}
+ @Override
public void visitConstantNameAndType(ConstantNameAndType obj) {}
@Override
public void visitConstantPool(ConstantPool obj) {}
public void visitAnnotationDefault(AnnotationDefault attribute) {}
@Override
public void visitLocalVariableTypeTable(LocalVariableTypeTable obj) {}
-
+
// J8:
@Override
public void visitRuntimeVisibleTypeAnnotations(RuntimeVisTypeAnnos attribute) {}
@Override public void visitConstantDynamic(ConstantDynamic attribute) {}
@Override public void visitNestHost(NestHost attribute) { }
@Override public void visitNestMembers(NestMembers attribute) { }
-
+
}