Java Code Examples for org.apache.bcel.classfile.ConstantPool#constantToString()

The following examples show how to use org.apache.bcel.classfile.ConstantPool#constantToString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InvokeInstruction.java    From commons-bcel with Apache License 2.0 6 votes vote down vote up
/**
 * @return mnemonic for instruction with symbolic references resolved
 */
@Override
public String toString( final ConstantPool cp ) {
    final Constant c = cp.getConstant(super.getIndex());
    final StringTokenizer tok = new StringTokenizer(cp.constantToString(c));

    final String opcodeName = Const.getOpcodeName(super.getOpcode());

    final StringBuilder sb = new StringBuilder(opcodeName);
    if (tok.hasMoreTokens()) {
        sb.append(" ");
        sb.append(tok.nextToken().replace('.', '/'));
        if (tok.hasMoreTokens()) {
            sb.append(tok.nextToken());
        }
    }

    return sb.toString();
}
 
Example 2
Source File: CPInstruction.java    From commons-bcel with Apache License 2.0 5 votes vote down vote up
/**
 * @return mnemonic for instruction with symbolic references resolved
 */
@Override
public String toString( final ConstantPool cp ) {
    final Constant c = cp.getConstant(index);
    String str = cp.constantToString(c);
    if (c instanceof ConstantClass) {
        str = str.replace('.', '/');
    }
    return org.apache.bcel.Const.getOpcodeName(super.getOpcode()) + " " + str;
}
 
Example 3
Source File: FieldInstruction.java    From ApkToolPlus with Apache License 2.0 4 votes vote down vote up
/**
 * @return mnemonic for instruction with symbolic references resolved
 */
public String toString(ConstantPool cp) {
  return org.apache.bcel.Constants.OPCODE_NAMES[opcode] + " " +
    cp.constantToString(index, org.apache.bcel.Constants.CONSTANT_Fieldref);
}
 
Example 4
Source File: FieldInstruction.java    From commons-bcel with Apache License 2.0 4 votes vote down vote up
/**
 * @return mnemonic for instruction with symbolic references resolved
 */
@Override
public String toString( final ConstantPool cp ) {
    return org.apache.bcel.Const.getOpcodeName(super.getOpcode()) + " "
            + cp.constantToString(super.getIndex(), org.apache.bcel.Const.CONSTANT_Fieldref);
}