本文整理了Java中org.objectweb.asm.tree.InsnList.clear()
方法的一些代码示例,展示了InsnList.clear()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。InsnList.clear()
方法的具体详情如下:
包路径:org.objectweb.asm.tree.InsnList
类名称:InsnList
方法名:clear
[英]Removes all of the instructions of this list.
[中]删除此列表中的所有说明。
代码示例来源:origin: pxb1988/dex2jar
@Override
public void convertCode(DexMethodNode methodNode, MethodVisitor mv) {
MethodVisitor mw = AsmBridge.searchMethodWriter(mv);
MethodNode mn = new MethodNode(Opcodes.ASM5, methodNode.access, methodNode.method.getName(),
methodNode.method.getDesc(), null, null);
try {
super.convertCode(methodNode, mn);
} catch (Exception ex) {
if (exceptionHandler == null) {
throw new DexException(ex, "fail convert code for %s", methodNode.method);
} else {
mn.instructions.clear();
mn.tryCatchBlocks.clear();
exceptionHandler.handleMethodTranslateException(methodNode.method, methodNode, mn, ex);
}
}
// code convert ok, copy to MethodWriter and check for Size
mn.accept(mv);
if (mw != null) {
try {
AsmBridge.sizeOfMethodWriter(mw);
} catch (Exception ex) {
mn.instructions.clear();
mn.tryCatchBlocks.clear();
exceptionHandler.handleMethodTranslateException(methodNode.method, methodNode, mn, ex);
AsmBridge.replaceMethodWriter(mw, mn);
}
}
}
}
代码示例来源:origin: robolectric/robolectric
method.instructions.clear();
代码示例来源:origin: fge/grappa
public CodeBlock clear()
{
instructionList.clear();
tryCatchBlockList.clear();
localVariableList.clear();
annotations.clear();
arity = 0;
returns = false;
return this;
}
}
代码示例来源:origin: iLexiconn/LLibrary
@Override
public void apply(MethodPatcher.PatchData patch, MethodNode methodNode, AbstractInsnNode location, Method method) {
methodNode.instructions.clear();
methodNode.instructions.add(method.insnList);
}
},
代码示例来源:origin: SleepyTrousers/EnderCore
@Override
void transform(Iterator<MethodNode> methods) {
boolean done = false;
while (methods.hasNext()) {
MethodNode m = methods.next();
if (isEmptyMethod.equals(m.name)) {
m.instructions.clear();
m.visitInsn(Opcodes.ICONST_0);
m.visitInsn(Opcodes.IRETURN);
done = true;
break;
}
}
if (!done) {
mainLogger.info("Transforming failed.");
}
}
});
代码示例来源:origin: fge/grappa
@Override
public void process(@Nonnull final ParserClassNode classNode,
@Nonnull final RuleMethod method)
throws Exception
{
Objects.requireNonNull(classNode, "classNode");
Objects.requireNonNull(method, "method");
// replace all method code with a simple call to the super method
final String parentDesc = classNode.getParentType().getInternalName();
final InsnList argumentLoaders = createArgumentLoaders(method.desc);
final CodeBlock block = CodeBlock.newCodeBlock()
.aload(0)
.addAll(argumentLoaders)
// TODO: create .invokeSpecial with MethodNode argument?
.invokespecial(parentDesc, method.name, method.desc)
.areturn();
method.instructions.clear();
method.instructions.add(block.getInstructionList());
}
}
代码示例来源:origin: RS485/LogisticsPipes
m.instructions.clear();
m.localVariables.clear();
m.tryCatchBlocks.clear();
代码示例来源:origin: SleepyTrousers/EnderCore
@Override
void transform(Iterator<MethodNode> methods) {
boolean done = false;
while (methods.hasNext()) {
MethodNode m = methods.next();
if (containerFurnaceMethod.equals(m.name)) {
m.instructions.clear();
m.instructions.add(new VarInsnNode(ALOAD, 0));
m.instructions.add(new VarInsnNode(ALOAD, 1));
m.instructions.add(new VarInsnNode(ILOAD, 2));
m.instructions.add(new MethodInsnNode(INVOKESTATIC, "com/enderio/core/common/transform/EnderCoreMethods", "transferStackInSlot",
containerFurnaceMethodSig, false));
m.instructions.add(new InsnNode(Opcodes.ARETURN));
done = true;
break;
}
}
if (!done) {
mainLogger.info("Transforming failed.");
}
}
});
代码示例来源:origin: org.parboiled/parboiled-java
public void process(ParserClassNode classNode, RuleMethod method) throws Exception {
checkArgNotNull(classNode, "classNode");
checkArgNotNull(method, "method");
// replace all method code with a simple call to the super method
method.instructions.clear();
method.instructions.add(new VarInsnNode(ALOAD, 0));
method.instructions.add(createArgumentLoaders(method.desc));
method.instructions.add(new MethodInsnNode(INVOKESPECIAL,
classNode.getParentType().getInternalName(), method.name, method.desc, classNode.isInterface()));
method.instructions.add(new InsnNode(ARETURN));
}
代码示例来源:origin: org.robolectric/robolectric-sandbox
private void instrumentConstructor(MethodNode method) {
makeMethodPrivate(method);
if (containsStubs) {
method.instructions.clear();
RobolectricGeneratorAdapter generator = new RobolectricGeneratorAdapter(method);
generator.loadThis();
generator.visitMethodInsn(INVOKESPECIAL, classNode.superName, "<init>", "()V");
generator.returnValue();
generator.endMethod();
}
InsnList removedInstructions = extractCallToSuperConstructor(method);
method.name = new ShadowImpl().directMethodName(ShadowConstants.CONSTRUCTOR_METHOD_NAME);
classNode.methods.add(redirectorMethod(method, ShadowConstants.CONSTRUCTOR_METHOD_NAME));
String[] exceptions = exceptionArray(method);
MethodNode methodNode = new MethodNode(method.access, "<init>", method.desc, method.signature, exceptions);
makeMethodPublic(methodNode);
RobolectricGeneratorAdapter generator = new RobolectricGeneratorAdapter(methodNode);
methodNode.instructions = removedInstructions;
generator.loadThis();
generator.invokeVirtual(classType, new Method(ROBO_INIT_METHOD_NAME, "()V"));
generateShadowCall(method, ShadowConstants.CONSTRUCTOR_METHOD_NAME, generator);
generator.endMethod();
classNode.methods.add(methodNode);
}
代码示例来源:origin: com.android.tools.build/builder
instructions.clear();
代码示例来源:origin: com.amazon.device.tools.build/builder
instructions.clear();
代码示例来源:origin: Glitchfiend/SereneSeasons
methodNode.instructions.clear();
methodNode.instructions.insert(insnList);
methodNode.instructions.clear();
methodNode.instructions.insert(insnList);
内容来源于网络,如有侵权,请联系作者删除!