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 testGetReturnTypes() throws Exception {
          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"));
  
          RpcInvocation inv = new RpcInvocation("testReturnType", serviceName, "", new Class<?>[]{String.class}, null, null, invoker, null);
          Type[] types = RpcUtils.getReturnTypes(inv);
          Assertions.assertNotNull(types);
          Assertions.assertEquals(2, types.length);
          Assertions.assertEquals(String.class, types[0]);
          Assertions.assertEquals(String.class, types[1]);
          Assertions.assertArrayEquals(types, inv.getReturnTypes());
  
          RpcInvocation inv1 = new RpcInvocation("testReturnType1", serviceName, "", new Class<?>[]{String.class}, null, null, invoker, null);
          java.lang.reflect.Type[] types1 = RpcUtils.getReturnTypes(inv1);
          Assertions.assertNotNull(types1);
          Assertions.assertEquals(2, types1.length);
          Assertions.assertEquals(List.class, types1[0]);
          Assertions.assertEquals(demoServiceClass.getMethod("testReturnType1", String.class).getGenericReturnType(), types1[1]);
          Assertions.assertArrayEquals(types1, inv1.getReturnTypes());
  
          RpcInvocation inv2 = new RpcInvocation("testReturnType2", serviceName, "", new Class<?>[]{String.class}, null, null, invoker, null);
          java.lang.reflect.Type[] types2 = RpcUtils.getReturnTypes(inv2);
          Assertions.assertNotNull(types2);
          Assertions.assertEquals(2, types2.length);
          Assertions.assertEquals(String.class, types2[0]);
          Assertions.assertEquals(String.class, types2[1]);
          Assertions.assertArrayEquals(types2, inv2.getReturnTypes());
  
          RpcInvocation inv3 = new RpcInvocation("testReturnType3", serviceName, "", new Class<?>[]{String.class}, null, null, invoker, null);
          java.lang.reflect.Type[] types3 = RpcUtils.getReturnTypes(inv3);
          Assertions.assertNotNull(types3);
          Assertions.assertEquals(2, types3.length);
          Assertions.assertEquals(List.class, types3[0]);
          java.lang.reflect.Type genericReturnType3 = demoServiceClass.getMethod("testReturnType3", String.class).getGenericReturnType();
          Assertions.assertEquals(((ParameterizedType) genericReturnType3).getActualTypeArguments()[0], types3[1]);
          Assertions.assertArrayEquals(types3, inv3.getReturnTypes());
  
          RpcInvocation inv4 = new RpcInvocation("testReturnType4", serviceName, "", new Class<?>[]{String.class}, null, null, invoker, null);
          java.lang.reflect.Type[] types4 = RpcUtils.getReturnTypes(inv4);
          Assertions.assertNotNull(types4);
          Assertions.assertEquals(2, types4.length);
          Assertions.assertNull(types4[0]);
          Assertions.assertNull(types4[1]);
          Assertions.assertArrayEquals(types4, inv4.getReturnTypes());
  
          RpcInvocation inv5 = new RpcInvocation("testReturnType5", serviceName, "", new Class<?>[]{String.class}, null, null, invoker, null);
          java.lang.reflect.Type[] types5 = RpcUtils.getReturnTypes(inv5);
          Assertions.assertNotNull(types5);
          Assertions.assertEquals(2, types5.length);
          Assertions.assertEquals(Map.class, types5[0]);
          java.lang.reflect.Type genericReturnType5 = demoServiceClass.getMethod("testReturnType5", String.class).getGenericReturnType();
          Assertions.assertEquals(((ParameterizedType) genericReturnType5).getActualTypeArguments()[0], types5[1]);
          Assertions.assertArrayEquals(types5, inv5.getReturnTypes());
      }
test_case.class_method_signature: RpcUtilsTest.testGetReturnTypes()
test_case.full_signature: @Test public void testGetReturnTypes()
test_case.identifier: testGetReturnTypes
test_case.invocations: getName mock willReturn given getUrl valueOf getReturnTypes assertNotNull assertEquals assertEquals assertEquals assertArrayEquals getReturnTypes getReturnTypes assertNotNull assertEquals assertEquals assertEquals getGenericReturnType getMethod assertArrayEquals getReturnTypes getReturnTypes assertNotNull assertEquals assertEquals assertEquals assertArrayEquals getReturnTypes getReturnTypes assertNotNull assertEquals assertEquals getGenericReturnType getMethod assertEquals getActualTypeArguments assertArrayEquals getReturnTypes getReturnTypes assertNotNull assertEquals assertNull assertNull assertArrayEquals getReturnTypes getReturnTypes assertNotNull assertEquals assertEquals getGenericReturnType getMethod assertEquals getActualTypeArguments assertArrayEquals getReturnTypes
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetReturnTypes()
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 Type[] getReturnTypes(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 ReflectUtils.getReturnTypes(method);
                  }
              }
          } catch (Throwable t) {
              logger.warn(t.getMessage(), t);
          }
          return null;
      }
focal_method.class_method_signature: RpcUtils.getReturnTypes(Invocation invocation)
focal_method.full_signature: public static Type[] getReturnTypes(Invocation invocation)
focal_method.identifier: getReturnTypes
focal_method.invocations: getInvoker getUrl getInvoker getInterface getInvoker startsWith getMethodName getServiceInterface getUrl getInvoker isNotEmpty getMethodByService getReturnTypes warn getMessage
focal_method.modifiers: public static
focal_method.parameters: (Invocation invocation)
focal_method.return: Type[]
focal_method.signature: Type[] getReturnTypes(Invocation invocation)