code: public static void addCorrectReturnInstruction(MethodVisitor mv, ReturnType returnType, boolean createCast) {
  		if (returnType.isPrimitive()) {
  			char ch = returnType.descriptor.charAt(0);
  			switch (ch) {
  				case 'V': // void is treated as a special primitive
  					mv.visitInsn(RETURN);
  					break;
  				case 'I':
  				case 'Z':
  				case 'S':
  				case 'B':
  				case 'C':
  					mv.visitInsn(IRETURN);
  					break;
  				case 'F':
  					mv.visitInsn(FRETURN);
  					break;
  				case 'D':
  					mv.visitInsn(DRETURN);
  					break;
  				case 'J':
  					mv.visitInsn(LRETURN);
  					break;
  				default:
  					throw new IllegalArgumentException("Not supported for '" + ch + "'");
  			}
  		}
  		else {
  			// either array or reference type
  			if (GlobalConfiguration.assertsMode) {
  				// Must not end with a ';' unless it starts with a '['
  				if (returnType.descriptor.endsWith(";") && !returnType.descriptor.startsWith("[")) {
  					throw new IllegalArgumentException("Invalid signature of '" + returnType.descriptor + "'");
  				}
  			}
  			if (createCast) {
  				mv.visitTypeInsn(CHECKCAST, returnType.descriptor);
  			}
  			mv.visitInsn(ARETURN);
  		}
  	}
docs: Depending on the signature of the return type, add the appropriate instructions to the method visitor.
  
  @param mv where to visit to append the instructions
  @param returnType return type descriptor
  @param createCast whether to include CHECKCAST instructions for return type values