类org.objectweb.asm.commons.CodeSizeEvaluator源码实例Demo

下面列出了怎么用org.objectweb.asm.commons.CodeSizeEvaluator的API类实例代码及写法,或者点击链接到github查看源代码。


/**
 * {@inheritDoc}
 *
 * <p>In addition, the returned {@link org.objectweb.asm.MethodVisitor} will throw an exception if
 * the method is greater than 64K in length.
 */
@Override
public MethodVisitor visitMethod(
    final int access,
    final String name,
    final String desc,
    final String signature,
    final String[] exceptions) {
  MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
  return new CodeSizeEvaluator(mv) {
    @Override
    public void visitEnd() {
      super.visitEnd();
      if (getMaxSize() > 64 * 1024) {
        state = State.FAIL_TOO_LONG;
        message = "the method " + name + " was too long.";
      }
    }
  };
}
 
源代码2 项目: radon   文件: MethodWrapper.java

/**
 * @return computes and returns the size of the wrapped {@link MethodNode}.
 */
public int getCodeSize() {
    CodeSizeEvaluator cse = new CodeSizeEvaluator(null);
    methodNode.accept(cse);
    return cse.getMaxSize();
}
 
 类所在包
 类方法
 同包方法