本文整理汇总了Java中org.objectweb.asm.tree.InsnList.accept方法的典型用法代码示例。如果您正苦于以下问题:Java InsnList.accept方法的具体用法?Java InsnList.accept怎么用?Java InsnList.accept使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.objectweb.asm.tree.InsnList
的用法示例。
在下文中一共展示了InsnList.accept方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createIsVisible
import org.objectweb.asm.tree.InsnList; //导入方法依赖的package包/类
public void createIsVisible(ClassNode cn) {
// again too lazy to make actual work
// steal it from original code and hope that it works ;)
InsnList method = null;
for (MethodNode mn : cn.methods) {
if (mn.desc.equals("()Z")) {
method = mn.instructions;
break;
}
}
MethodVisitor mv = cn.visitMethod(ACC_PUBLIC, "isVisible", "()Z", null, null);
method.accept(mv);
mv.visitEnd();
}
示例2: toString
import org.objectweb.asm.tree.InsnList; //导入方法依赖的package包/类
public static List<String> toString(InsnList instructions) {
Printer p = new Textifier();
TraceMethodVisitor mp = new TraceMethodVisitor(p);
instructions.accept(mp);
return p.getText().stream()
.map(Object::toString)
.map(String::trim)
.collect(toList());
}
示例3: testSwitch
import org.objectweb.asm.tree.InsnList; //导入方法依赖的package包/类
private void testSwitch() {
InsnList insnList = new InsnList();
LabelNode defaultLabelNode = new LabelNode(new Label());
LabelNode[] nodes = new LabelNode[2];
nodes[0] = new LabelNode(new Label());
nodes[1] = new LabelNode(new Label());
nodes[0].accept(ga);
ga.push(42);
nodes[1].accept(ga);
ga.push(43);
LookupSwitchInsnNode lookupSwitchInsnNode = new LookupSwitchInsnNode(defaultLabelNode, new int[]{1, 2}, nodes);
insnList.add(lookupSwitchInsnNode);
insnList.accept(ga);
}
示例4: createIsKeyDown
import org.objectweb.asm.tree.InsnList; //导入方法依赖的package包/类
private void createIsKeyDown(ClassNode cn) {
// again too lazy to make actual work
// steal it from original code and hope that it works ;)
for (MethodNode mn : cn.methods) {
if (mn.desc.equals("(LHTMud/InputActionTracker$ActionType;)Z")) {
InsnList method = mn.instructions;
MethodVisitor mv = cn.visitMethod(ACC_PUBLIC, "isKeyDown", mn.desc, null, null);
method.accept(mv);
mv.visitEnd();
break;
}
}
}