本文整理汇总了Java中org.objectweb.asm.Opcodes.ARETURN属性的典型用法代码示例。如果您正苦于以下问题:Java Opcodes.ARETURN属性的具体用法?Java Opcodes.ARETURN怎么用?Java Opcodes.ARETURN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.objectweb.asm.Opcodes
的用法示例。
在下文中一共展示了Opcodes.ARETURN属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hookMethod
/**
* (none-javadoc)
*
* @see AbstractClassHook#hookMethod(int, String, String, String, String[], MethodVisitor)
*/
@Override
protected MethodVisitor hookMethod(int access, String name, String desc, String signature, String[] exceptions, MethodVisitor mv) {
if ("lookup".equals(name) && desc.startsWith("(Ljava/lang/String;)")) {
return new AdviceAdapter(Opcodes.ASM5, mv, access, name, desc) {
@Override
public void onMethodExit(int opcode) {
if (opcode == Opcodes.ARETURN) {
mv.visitVarInsn(ALOAD, 2);
mv.visitMethodInsn(INVOKESTATIC, "com/fuxi/javaagent/hook/ProxyDirContextHook", "checkResourceCacheEntry",
"(Ljava/lang/Object;)V", false);
}
super.onMethodExit(opcode);
}
};
}
return mv;
}
示例2: callBack
@SuppressWarnings("deprecation")
private static void callBack(MethodNode mn) {
InsnList nl = new InsnList();
AbstractInsnNode[] mnNodes = mn.instructions.toArray();
for (AbstractInsnNode abstractInsnNode : mnNodes) {
if (abstractInsnNode.getOpcode() == Opcodes.ARETURN) {
System.out.println("Injecting ObjectDefinition Callback...");
nl.add(new VarInsnNode(Opcodes.ILOAD, 0));
nl.add(new MethodInsnNode(Opcodes.INVOKESTATIC, ObjectDefinitionCallBack.class.getCanonicalName().replace('.', '/'), "add", "(" + "Ljava/lang/Object;I" + ")V"));
nl.add(new VarInsnNode(Opcodes.ALOAD, 2));
}
nl.add(abstractInsnNode);
}
mn.instructions = nl;
mn.visitMaxs(0, 0);
mn.visitEnd();
}
示例3: asmMethodReturn
/**
* 组装被拦截方法正常返回时的拦截动作
*/
@SuppressWarnings("unchecked")
private static void asmMethodReturn(MethodModifierContext context) {
InsnList il = context.mn.instructions;
Iterator<AbstractInsnNode> it = il.iterator();
while (it.hasNext()) {
AbstractInsnNode abstractInsnNode = it.next();
switch (abstractInsnNode.getOpcode()) {
case Opcodes.RETURN:
il.insertBefore(abstractInsnNode, createVoidReturnInstructions(context));
break;
case Opcodes.IRETURN:
case Opcodes.LRETURN:
case Opcodes.FRETURN:
case Opcodes.ARETURN:
case Opcodes.DRETURN:
il.insertBefore(abstractInsnNode, createReturnInstructions(context));
}
}
}
示例4: getReturnTypeCode
/**
* 针对不同类型返回指令不一样
*
* @param typeS
* @return
*/
private static int getReturnTypeCode(String typeS) {
if ("Z".equals(typeS)) {
return Opcodes.IRETURN;
}
if ("B".equals(typeS)) {
return Opcodes.IRETURN;
}
if ("C".equals(typeS)) {
return Opcodes.IRETURN;
}
if ("S".equals(typeS)) {
return Opcodes.IRETURN;
}
if ("I".equals(typeS)) {
return Opcodes.IRETURN;
}
if ("F".equals(typeS)) {
return Opcodes.FRETURN;
}
if ("D".equals(typeS)) {
return Opcodes.DRETURN;
}
if ("J".equals(typeS)) {
return Opcodes.LRETURN;
}
return Opcodes.ARETURN;
}