* Get a signature of the reference (e.g. method's signature or
* field's signature).
*/
public String getDescriptor() {
ConstantPool.Entry entry = cp.get(getIndex());
NameAndTypeInfo nti = null;
if (entry instanceof ConstantPool.MethodRefInfo) {
ConstantPool.MethodRefInfo mri = (ConstantPool.MethodRefInfo)entry;
nti = mri.getNameAndTypeInfo();
}
else if (entry instanceof ConstantPool.FieldRefInfo) {
ConstantPool.FieldRefInfo fri = (ConstantPool.FieldRefInfo)entry;
nti = fri.getNameAndTypeInfo();
}
else if (entry instanceof ConstantPool.InterfaceMethodRefInfo) {
ConstantPool.InterfaceMethodRefInfo fri =
(ConstantPool.InterfaceMethodRefInfo)entry;
nti = fri.getNameAndTypeInfo();
}
else {
System.out.println(cp);
System.out.println("Failed to get (interface)Method/Field ref-info from index " + getIndex() + ": " + entry);
System.out.println("Instruction: " +
Opcodes.opcodeStrings[getOpcode()&0xff]);
}
return nti.getDescriptor();
}