当前位置: 首页>>代码示例>>Java>>正文


Java MethodNode.accept方法代码示例

本文整理汇总了Java中org.objectweb.asm.tree.MethodNode.accept方法的典型用法代码示例。如果您正苦于以下问题:Java MethodNode.accept方法的具体用法?Java MethodNode.accept怎么用?Java MethodNode.accept使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.objectweb.asm.tree.MethodNode的用法示例。


在下文中一共展示了MethodNode.accept方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dump

import org.objectweb.asm.tree.MethodNode; //导入方法依赖的package包/类
private static void dump(MethodNode method) {
	Textifier textifier = new Textifier();
	method.accept(new TraceMethodVisitor(textifier));

	StringWriter writer = new StringWriter();

	try (PrintWriter pw = new PrintWriter(writer)) {
		textifier.print(pw);
	}

	System.out.println(writer.toString());
}
 
开发者ID:sfPlayer1,项目名称:Matcher,代码行数:13,代码来源:Analysis.java

示例2: visitEnd

import org.objectweb.asm.tree.MethodNode; //导入方法依赖的package包/类
@Override
public void visitEnd() {
  // add all the fields of the class we're going to merge.
  for (Iterator<?> it = classToMerge.fields.iterator(); it.hasNext();) {
    ((FieldNode) it.next()).accept(this);
  }

  // add all the methods that we to include.
  for (Iterator<?> it = classToMerge.methods.iterator(); it.hasNext();) {
    MethodNode mn = (MethodNode) it.next();

    if (mn.name.equals("<init>")) {
      continue;
    }

    String[] exceptions = new String[mn.exceptions.size()];
    mn.exceptions.toArray(exceptions);
    MethodVisitor mv = cv.visitMethod(mn.access | Modifier.FINAL, mn.name, mn.desc, mn.signature, exceptions);
    if (verifyBytecode) {
      mv = new CheckMethodVisitorFsm(api, mv);
    }

    mn.instructions.resetLabels();

    // mn.accept(new RemappingMethodAdapter(mn.access, mn.desc, mv, new
    // SimpleRemapper("org.apache.drill.exec.compile.ExampleTemplate", "Bunky")));
    ClassSet top = set;
    while (top.parent != null) {
      top = top.parent;
    }
    mn.accept(new RemappingMethodAdapter(mn.access, mn.desc, mv,
        new SimpleRemapper(top.precompiled.slash, top.generated.slash)));

  }
  super.visitEnd();
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:37,代码来源:MergeAdapter.java

示例3: visitMethod

import org.objectweb.asm.tree.MethodNode; //导入方法依赖的package包/类
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature,
                                 String[] exceptions) {
    AcesoProguardMap.instance().putMethod(visitedClassName, IncrementalTool.getMtdSig(name, desc));
    access = IncrementalTool.transformAccessForInstantRun(access);

    MethodVisitor defaultVisitor = super.visitMethod(access, name, desc, signature, exceptions);
    MethodNode method = getMethodByNameInClass(name, desc, classNode);
    // does the method use blacklisted APIs.
    boolean hasIncompatibleChange = InstantRunMethodVerifier.verifyMethod(method);

    if (hasIncompatibleChange || disableRedirectionForClass
            || !isAccessCompatibleWithInstantRun(access)
            || name.equals(ByteCodeUtils.CLASS_INITIALIZER)) {
        return defaultVisitor;
    } else {
        ArrayList<Type> args = new ArrayList<Type>(Arrays.asList(Type.getArgumentTypes(desc)));
        boolean isStatic = (access & Opcodes.ACC_STATIC) != 0;
        if (!isStatic) {
            args.add(0, Type.getType(Object.class));
        }

        ISMethodVisitor mv = new ISMethodVisitor(defaultVisitor, access, name, desc);
        if (name.equals(ByteCodeUtils.CONSTRUCTOR)) {

        } else {
            mv.addRedirection(new MethodRedirection(
                    new LabelNode(mv.getStartLabel()),
                    visitedClassName,
                    name,
                    desc,
                    args,
                    Type.getReturnType(desc), isStatic));
        }
        method.accept(mv);
        return null;
    }
}
 
开发者ID:meili,项目名称:Aceso,代码行数:39,代码来源:IncrementalSupportVisitor.java

示例4: verifyMethod

import org.objectweb.asm.tree.MethodNode; //导入方法依赖的package包/类
/**
 * Verifies a method implementation against the blacklisted list of APIs.
 */
public static boolean verifyMethod(MethodNode method) {
    VerifierMethodVisitor mv = new VerifierMethodVisitor(method);
    method.accept(mv);
    return (mv.incompatibleChange == InstantRunVerifierStatus.INCOMPATIBLE);
}
 
开发者ID:meili,项目名称:Aceso,代码行数:9,代码来源:InstantRunMethodVerifier.java


注:本文中的org.objectweb.asm.tree.MethodNode.accept方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。