// now calculate the parameters
int offset = 1;
for (Class<?> aClass : delegatedMethod.getParameterTypes())
{
final Type type = Type.getType(aClass);
mv.visitVarInsn(type.getOpcode(Opcodes.ILOAD), offset);
offset += type.getSize();
}
// and finally invoke the target method on the provided Contextual Instance
final Type declaringClass = Type.getType(delegatedMethod.getDeclaringClass());
boolean interfaceMethod = Modifier.isInterface(delegatedMethod.getDeclaringClass().getModifiers());
mv.visitMethodInsn(interfaceMethod ? Opcodes.INVOKEINTERFACE : Opcodes.INVOKEVIRTUAL,
declaringClass.getInternalName(), delegatedMethod.getName(), methodDescriptor);
generateReturn(mv, delegatedMethod);
mv.visitMaxs(-1, -1);