當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。