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

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

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

Method.toString介绍

[英]Return string representation close to declaration format, public static void main(String[] args) throws IOException', e.g. [中]返回接近声明格式的字符串表示形式,public static void main(string[]args)抛出IOException',例如。

代码示例

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

@Override
public void visitClassContext(ClassContext classContext) {
  JavaClass javaClass = classContext.getJavaClass();
  Method[] methodList = javaClass.getMethods();
  for (Method method : methodList) {
    MethodGen methodGen = classContext.getMethodGen(method);
    if (methodGen == null) {
      continue;
    }
    if (!prescreen(classContext, method)) {
      continue;
    }
    try {
      analyzeMethod(classContext, method);
    } catch (DataflowAnalysisException e) {
      bugReporter.logError("Error analyzing " + method.toString(), e);
    } catch (CFGBuilderException e) {
      bugReporter.logError("Error analyzing " + method.toString(), e);
    }
  }
}

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

analyzeMethod(classContext, method);
} catch (DataflowAnalysisException e) {
  bugReporter.logError("Error analyzing " + method.toString(), e);
} catch (CFGBuilderException e) {
  bugReporter.logError("Error analyzing " + method.toString(), e);

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

bugReporter.logError("Error analyzing " + method.toString(), e);

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

bugReporter.logError("Error analyzing method " + method.toString(), e);
} catch (DataflowAnalysisException e) {
  bugReporter.logError("Error analyzing method " + method.toString(), e);

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

@Override
public void visitClassContext(ClassContext classContext) {
  this.classContext = classContext;
  JavaClass jclass = classContext.getJavaClass();
  Method[] methodList = jclass.getMethods();
  for (Method method : methodList) {
    MethodGen methodGen = classContext.getMethodGen(method);
    if (methodGen == null) {
      continue;
    }
    // Prescreening - must have IF_ACMPEQ, IF_ACMPNE,
    // or an invocation of an instance method
    BitSet bytecodeSet = classContext.getBytecodeSet(method);
    if (bytecodeSet == null || !bytecodeSet.intersects(prescreenSet)) {
      continue;
    }
    if (DEBUG) {
      System.out.println("FindRefComparison: analyzing " + SignatureConverter.convertMethodSignature(methodGen));
    }
    try {
      analyzeMethod(classContext, method);
    } catch (CFGBuilderException e) {
      bugReporter.logError("Error analyzing " + method.toString(), e);
    } catch (DataflowAnalysisException e) {
      // bugReporter.logError("Error analyzing " + method.toString(),
      // e);
    }
    bugAccumulator.reportAccumulatedBugs();
  }
}

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

@Override
public void visitClassContext(ClassContext classContext) {
  JavaClass javaClass = classContext.getJavaClass();
  Method[] methodList = javaClass.getMethods();
  for (Method method : methodList) {
    MethodGen methodGen = classContext.getMethodGen(method);
    if (methodGen == null) {
      continue;
    }
    if (!prescreen(classContext, method)) {
      continue;
    }
    try {
      analyzeMethod(classContext, method);
    } catch (DataflowAnalysisException e) {
      bugReporter.logError("Error analyzing " + method.toString(), e);
    } catch (CFGBuilderException e) {
      bugReporter.logError("Error analyzing " + method.toString(), e);
    }
  }
}

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

analyzeMethod(classContext, method);
} catch (DataflowAnalysisException e) {
  bugReporter.logError("Error analyzing " + method.toString(), e);
} catch (CFGBuilderException e) {
  bugReporter.logError("Error analyzing " + method.toString(), e);

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

bugReporter.logError("Error analyzing " + method.toString(), e);

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

bugReporter.logError("Error analyzing method " + method.toString(), e);
} catch (DataflowAnalysisException e) {
  bugReporter.logError("Error analyzing method " + method.toString(), e);

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

private void compare(final String name, final Method m) {
  // System.out.println("Method: " + m);
  final Code c = m.getCode();
  if (c == null) {
    return; // e.g. abstract method
  }
  final byte[] src = c.getCode();
  final InstructionList il = new InstructionList(src);
  final byte[] out = il.getByteCode();
  if (src.length == out.length) {
    assertArrayEquals(name + ": " + m.toString(), src, out);
  } else {
    System.out.println(name + ": " + m.toString() + " " + src.length + " " + out.length);
    System.out.println(bytesToHex(src));
    System.out.println(bytesToHex(out));
    for (final InstructionHandle ih : il) {
      System.out.println(ih.toString(false));
    }
    fail("Array comparison failure");
  }
}

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

methodnames[i] = jc.getMethods()[i].toString().replace('\n', ' ').replace('\t',
    ' ');

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

@Override
public void visitClassContext(ClassContext classContext) {
  this.classContext = classContext;
  JavaClass jclass = classContext.getJavaClass();
  Method[] methodList = jclass.getMethods();
  for (Method method : methodList) {
    MethodGen methodGen = classContext.getMethodGen(method);
    if (methodGen == null) {
      continue;
    }
    // Prescreening - must have IF_ACMPEQ, IF_ACMPNE,
    // or an invocation of an instance method
    BitSet bytecodeSet = classContext.getBytecodeSet(method);
    if (bytecodeSet == null || !bytecodeSet.intersects(prescreenSet)) {
      continue;
    }
    if (DEBUG) {
      System.out.println("FindRefComparison: analyzing " + SignatureConverter.convertMethodSignature(methodGen));
    }
    try {
      analyzeMethod(classContext, method);
    } catch (CFGBuilderException e) {
      bugReporter.logError("Error analyzing " + method.toString(), e);
    } catch (DataflowAnalysisException e) {
      // bugReporter.logError("Error analyzing " + method.toString(),
      // e);
    }
    bugAccumulator.reportAccumulatedBugs();
  }
}

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

methodnames[i] = jc.getMethods()[i].toString().replace('\n',' ').replace('\t',' ');

相关文章