@SuppressWarnings({ "rawtypes", "unchecked" })
private static void generateCodeForReturnStatement(Code code, Class methodReturnType,
Local localForResultOfInvoke, Local localOfMethodReturnType, Local aBoxedResult) {
if (PRIMITIVE_TO_UNBOX_METHOD.containsKey(methodReturnType)) {
code.cast(aBoxedResult, localForResultOfInvoke);
MethodId unboxingMethodFor = getUnboxMethodForPrimitive(methodReturnType);
code.invokeVirtual(unboxingMethodFor, localOfMethodReturnType, aBoxedResult);
code.returnValue(localOfMethodReturnType);
} else if (void.class.equals(methodReturnType)) {
code.returnVoid();
} else {