How to dynamically cast an object (of class Object) to the method return type using ASM?

What I want to do is to modify a method using ASM: I push an object (of class Object) to the stack I want to cast that object to the return type of that method Return that casted object. My code in …

ASM: how to easily get proper Opcode based on type

I am using ASM to generate Java bytecode. I have a need to create a dynamic proxy which can override basically any kind of method with additional post-processing. I am able to do it all, but there is …