本文整理汇总了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());
}
示例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();
}
示例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;
}
}
示例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);
}