本文整理匯總了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;
}
}
}