test_class.file: dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/support/RpcUtilsTest.java
test_class.identifier: RpcUtilsTest
test_case.body: @Test
      public void testGetReturnType() {
          Class<?> demoServiceClass = DemoService.class;
          String serviceName = demoServiceClass.getName();
          Invoker invoker = mock(Invoker.class);
          given(invoker.getUrl()).willReturn(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);
  
      }
test_case.class_method_signature: RpcUtilsTest.testGetReturnType()
test_case.full_signature: @Test public void testGetReturnType()
test_case.identifier: testGetReturnType
test_case.invocations: getName mock willReturn given getUrl valueOf getReturnType assertNull getReturnType assertNotNull assertEquals getReturnType assertNotNull assertEquals getReturnType assertNotNull assertEquals getReturnType assertNotNull assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetReturnType()
focal_class.declarator: logger = LoggerFactory.getLogger(RpcUtils.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(RpcUtils.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: INVOKE_ID = new AtomicLong(0)
focal_class.modifier: private static final
focal_class.original_string: private static final AtomicLong INVOKE_ID = new AtomicLong(0);
focal_class.type: AtomicLong
focal_class.var_name: INVOKE_ID
focal_class.file: dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/support/RpcUtils.java
focal_class.identifier: RpcUtils
focal_class.class_method_signature: RpcUtils.getReturnType(Invocation invocation)
focal_class.full_signature: public static Class<?> getReturnType(Invocation invocation)
focal_class.identifier: getReturnType
focal_class.modifiers: public static
focal_class.parameters: (Invocation invocation)
focal_class.return: Class<?>
focal_class.signature: Class<?> getReturnType(Invocation invocation)
focal_class.class_method_signature: RpcUtils.getReturnTypes(Invocation invocation)
focal_class.full_signature: public static Type[] getReturnTypes(Invocation invocation)
focal_class.identifier: getReturnTypes
focal_class.modifiers: public static
focal_class.parameters: (Invocation invocation)
focal_class.return: Type[]
focal_class.signature: Type[] getReturnTypes(Invocation invocation)
focal_class.class_method_signature: RpcUtils.getInvocationId(Invocation inv)
focal_class.full_signature: public static Long getInvocationId(Invocation inv)
focal_class.identifier: getInvocationId
focal_class.modifiers: public static
focal_class.parameters: (Invocation inv)
focal_class.return: Long
focal_class.signature: Long getInvocationId(Invocation inv)
focal_class.class_method_signature: RpcUtils.attachInvocationIdIfAsync(URL url, Invocation inv)
focal_class.full_signature: public static void attachInvocationIdIfAsync(URL url, Invocation inv)
focal_class.identifier: attachInvocationIdIfAsync
focal_class.modifiers: public static
focal_class.parameters: (URL url, Invocation inv)
focal_class.return: void
focal_class.signature: void attachInvocationIdIfAsync(URL url, Invocation inv)
focal_class.class_method_signature: RpcUtils.isAttachInvocationId(URL url, Invocation invocation)
focal_class.full_signature: private static boolean isAttachInvocationId(URL url, Invocation invocation)
focal_class.identifier: isAttachInvocationId
focal_class.modifiers: private static
focal_class.parameters: (URL url, Invocation invocation)
focal_class.return: boolean
focal_class.signature: boolean isAttachInvocationId(URL url, Invocation invocation)
focal_class.class_method_signature: RpcUtils.getMethodName(Invocation invocation)
focal_class.full_signature: public static String getMethodName(Invocation invocation)
focal_class.identifier: getMethodName
focal_class.modifiers: public static
focal_class.parameters: (Invocation invocation)
focal_class.return: String
focal_class.signature: String getMethodName(Invocation invocation)
focal_class.class_method_signature: RpcUtils.getArguments(Invocation invocation)
focal_class.full_signature: public static Object[] getArguments(Invocation invocation)
focal_class.identifier: getArguments
focal_class.modifiers: public static
focal_class.parameters: (Invocation invocation)
focal_class.return: Object[]
focal_class.signature: Object[] getArguments(Invocation invocation)
focal_class.class_method_signature: RpcUtils.getParameterTypes(Invocation invocation)
focal_class.full_signature: public static Class<?>[] getParameterTypes(Invocation invocation)
focal_class.identifier: getParameterTypes
focal_class.modifiers: public static
focal_class.parameters: (Invocation invocation)
focal_class.return: Class<?>[]
focal_class.signature: Class<?>[] getParameterTypes(Invocation invocation)
focal_class.class_method_signature: RpcUtils.isAsync(URL url, Invocation inv)
focal_class.full_signature: public static boolean isAsync(URL url, Invocation inv)
focal_class.identifier: isAsync
focal_class.modifiers: public static
focal_class.parameters: (URL url, Invocation inv)
focal_class.return: boolean
focal_class.signature: boolean isAsync(URL url, Invocation inv)
focal_class.class_method_signature: RpcUtils.isReturnTypeFuture(Invocation inv)
focal_class.full_signature: public static boolean isReturnTypeFuture(Invocation inv)
focal_class.identifier: isReturnTypeFuture
focal_class.modifiers: public static
focal_class.parameters: (Invocation inv)
focal_class.return: boolean
focal_class.signature: boolean isReturnTypeFuture(Invocation inv)
focal_class.class_method_signature: RpcUtils.isGenericAsync(Invocation inv)
focal_class.full_signature: public static boolean isGenericAsync(Invocation inv)
focal_class.identifier: isGenericAsync
focal_class.modifiers: public static
focal_class.parameters: (Invocation inv)
focal_class.return: boolean
focal_class.signature: boolean isGenericAsync(Invocation inv)
focal_class.class_method_signature: RpcUtils.isGenericCall(String parameterTypesDesc, String method)
focal_class.full_signature: public static boolean isGenericCall(String parameterTypesDesc, String method)
focal_class.identifier: isGenericCall
focal_class.modifiers: public static
focal_class.parameters: (String parameterTypesDesc, String method)
focal_class.return: boolean
focal_class.signature: boolean isGenericCall(String parameterTypesDesc, String method)
focal_class.class_method_signature: RpcUtils.isEcho(String parameterTypesDesc, String method)
focal_class.full_signature: public static boolean isEcho(String parameterTypesDesc, String method)
focal_class.identifier: isEcho
focal_class.modifiers: public static
focal_class.parameters: (String parameterTypesDesc, String method)
focal_class.return: boolean
focal_class.signature: boolean isEcho(String parameterTypesDesc, String method)
focal_class.class_method_signature: RpcUtils.getInvokeMode(URL url, Invocation inv)
focal_class.full_signature: public static InvokeMode getInvokeMode(URL url, Invocation inv)
focal_class.identifier: getInvokeMode
focal_class.modifiers: public static
focal_class.parameters: (URL url, Invocation inv)
focal_class.return: InvokeMode
focal_class.signature: InvokeMode getInvokeMode(URL url, Invocation inv)
focal_class.class_method_signature: RpcUtils.isOneway(URL url, Invocation inv)
focal_class.full_signature: public static boolean isOneway(URL url, Invocation inv)
focal_class.identifier: isOneway
focal_class.modifiers: public static
focal_class.parameters: (URL url, Invocation inv)
focal_class.return: boolean
focal_class.signature: boolean isOneway(URL url, Invocation inv)
focal_class.class_method_signature: RpcUtils.getMethodByService(Invocation invocation, String service)
focal_class.full_signature: private static Method getMethodByService(Invocation invocation, String service)
focal_class.identifier: getMethodByService
focal_class.modifiers: private static
focal_class.parameters: (Invocation invocation, String service)
focal_class.return: Method
focal_class.signature: Method getMethodByService(Invocation invocation, String service)
focal_class.class_method_signature: RpcUtils.getTimeout(Invocation invocation, long defaultTimeout)
focal_class.full_signature: public static long getTimeout(Invocation invocation, long defaultTimeout)
focal_class.identifier: getTimeout
focal_class.modifiers: public static
focal_class.parameters: (Invocation invocation, long defaultTimeout)
focal_class.return: long
focal_class.signature: long getTimeout(Invocation invocation, long defaultTimeout)
focal_class.class_method_signature: RpcUtils.getTimeout(URL url, String methodName, RpcContext context, long defaultTimeout)
focal_class.full_signature: public static long getTimeout(URL url, String methodName, RpcContext context, long defaultTimeout)
focal_class.identifier: getTimeout
focal_class.modifiers: public static
focal_class.parameters: (URL url, String methodName, RpcContext context, long defaultTimeout)
focal_class.return: long
focal_class.signature: long getTimeout(URL url, String methodName, RpcContext context, long defaultTimeout)
focal_class.class_method_signature: RpcUtils.convertToNumber(Object obj, long defaultTimeout)
focal_class.full_signature: private static long convertToNumber(Object obj, long defaultTimeout)
focal_class.identifier: convertToNumber
focal_class.modifiers: private static
focal_class.parameters: (Object obj, long defaultTimeout)
focal_class.return: long
focal_class.signature: long convertToNumber(Object obj, long defaultTimeout)
focal_method.body: 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.getReturnType();
                  }
              }
          } catch (Throwable t) {
              logger.warn(t.getMessage(), t);
          }
          return null;
      }
focal_method.class_method_signature: RpcUtils.getReturnType(Invocation invocation)
focal_method.full_signature: public static Class<?> getReturnType(Invocation invocation)
focal_method.identifier: getReturnType
focal_method.invocations: getInvoker getUrl getInvoker getInterface getInvoker startsWith getMethodName getServiceInterface getUrl getInvoker isNotEmpty getMethodByService getReturnType warn getMessage
focal_method.modifiers: public static
focal_method.parameters: (Invocation invocation)
focal_method.return: Class<?>
focal_method.signature: Class<?> getReturnType(Invocation invocation)