org.apache.bcel.classfile.Method.getConstantPool()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(86)

本文整理了Java中org.apache.bcel.classfile.Method.getConstantPool()方法的一些代码示例,展示了Method.getConstantPool()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Method.getConstantPool()方法的具体详情如下:
包路径:org.apache.bcel.classfile.Method
类名称:Method
方法名:getConstantPool

Method.getConstantPool介绍

暂无

代码示例

代码示例来源:origin: spotbugs/spotbugs

public static int getSizeOfSurroundingTryBlock(@CheckForNull Method method, @CheckForNull String vmNameOfExceptionClass, int pc) {
  if (method == null) {
    return Integer.MAX_VALUE;
  }
  return getSizeOfSurroundingTryBlock(method.getConstantPool(), method.getCode(), vmNameOfExceptionClass, pc);
}

代码示例来源:origin: com.google.code.findbugs/findbugs

public static int getSizeOfSurroundingTryBlock(@CheckForNull Method method, @CheckForNull String vmNameOfExceptionClass, int pc) {
  if (method == null) {
    return Integer.MAX_VALUE;
  }
  return getSizeOfSurroundingTryBlock(method.getConstantPool(), method.getCode(), vmNameOfExceptionClass, pc);
}

代码示例来源:origin: com.g2forge.alexandria/ax-analysis

protected static String getField(Type target, String name, Type ret, Type[] args) throws ClassNotFoundException {
  final JavaClass clazz = Repository.lookupClass(target.toString());
  for (Method method : clazz.getMethods()) {
    if (method.getName().equals(name) && method.getSignature().equals(Type.getMethodSignature(ret, args))) {
      final Code code = method.getCode();
      final Instruction[] instructions = new InstructionList(code.getCode()).getInstructions();
      if (instructions.length != 3) throw new Error("Method " + method + " does not have exactly three instruction!");
      if (!(instructions[0] instanceof ALOAD) || (((ALOAD) instructions[0]).getIndex() != 0)) throw new Error();
      if (!(instructions[instructions.length - 1] instanceof ReturnInstruction)) throw new Error();
      final ConstantPoolGen constantPoolGen = new ConstantPoolGen(method.getConstantPool());
      final GETFIELD get = ((GETFIELD) instructions[1]);
      return get.getFieldName(constantPoolGen);
    }
  }
  throw new Error();
}

代码示例来源:origin: com.g2forge.alexandria/ax-analysis

final ConstantPoolGen constantPoolGen = new ConstantPoolGen(method.getConstantPool());
for (int i = 1; i < instructions.length - 1; i++) {
  final String field;

代码示例来源:origin: org.apache.bcel/bcel

ObjectType c_type = null;
if (type > 0) {
  final String cen = m.getConstantPool().getConstantString(type,
      Const.CONSTANT_Class);
  c_type =  ObjectType.getInstance(cen);

代码示例来源:origin: bcel/bcel

String cen = m.getConstantPool().getConstantString(type, Constants.CONSTANT_Class);
c_type = new ObjectType(cen);

相关文章