public static Class<?> getReturnType(Invocation invocation) {
        try {
            if (invocation != null
                    && invocation.getInvoker() != null
                    && invocation.getInvoker().getUrl() != null
                    && invocation.getInvoker().getInterface() != GenericService.class
                    && !invocation.getMethodName().startsWith("$")) {
                String service = invocation.getInvoker().getUrl().getServiceInterface();
                if (StringUtils.isNotEmpty(service)) {
                    Method method = getMethodByService(invocation, service);
                    return method == null ? null : method.getReturnType();
                }
            }
        } catch (Throwable t) {
            logger.warn(COMMON_REFLECTIVE_OPERATION_FAILED, "", "", t.getMessage(), t);
        }
        return null;
    }
@Test
    void testGetReturnType() {
        Class<?> demoServiceClass = DemoService.class;
        String serviceName = demoServiceClass.getName();
        Invoker invoker = createMockInvoker(
                URL.valueOf(
                        "test://127.0.0.1:1/org.apache.dubbo.rpc.support.DemoService?interface=org.apache.dubbo.rpc.support.DemoService"));

        // void sayHello(String name);
        RpcInvocation inv = new RpcInvocation(
                "sayHello", serviceName, "", new Class<?>[] {String.class}, null, null, invoker, null);
        Class<?> returnType = RpcUtils.getReturnType(inv);
        Assertions.assertNull(returnType);

        // String echo(String text);
        RpcInvocation inv1 =
                new RpcInvocation("echo", serviceName, "", new Class<?>[] {String.class}, null, null, invoker, null);
        Class<?> returnType1 = RpcUtils.getReturnType(inv1);
        Assertions.assertNotNull(returnType1);
        Assertions.assertEquals(String.class, returnType1);

        // int getSize(String[] strs);
        RpcInvocation inv2 = new RpcInvocation(
                "getSize", serviceName, "", new Class<?>[] {String[].class}, null, null, invoker, null);
        Class<?> returnType2 = RpcUtils.getReturnType(inv2);
        Assertions.assertNotNull(returnType2);
        Assertions.assertEquals(int.class, returnType2);

        // Person getPerson(Person person);
        RpcInvocation inv3 = new RpcInvocation(
                "getPerson", serviceName, "", new Class<?>[] {Person.class}, null, null, invoker, null);
        Class<?> returnType3 = RpcUtils.getReturnType(inv3);
        Assertions.assertNotNull(returnType3);
        Assertions.assertEquals(Person.class, returnType3);

        // List<String> testReturnType1(String str);
        RpcInvocation inv4 = new RpcInvocation(
                "testReturnType1", serviceName, "", new Class<?>[] {String.class}, null, null, invoker, null);
        Class<?> returnType4 = RpcUtils.getReturnType(inv4);
        Assertions.assertNotNull(returnType4);
        Assertions.assertEquals(List.class, returnType4);
    }