focuse8 opened a new issue, #13368:
URL: https://github.com/apache/dubbo/issues/13368

   <!-- If you need to report a security issue please visit 
https://github.com/apache/dubbo/security/policy -->
   
   - [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) 
of this repository and believe that this is not a duplicate.
   
   ### Environment
   
   * Dubbo version: 3.2.7
   * Operating System version: xxx
   * Java version: 1.8
   
   ### Steps to reproduce this issue
   
   1. 设置dubbo版本3.2.7
   2. triple协议泛型掉用 genericService.$invoke("methodName", null, new Object[])
   
   Pls. provide [GitHub address] to reproduce this issue.
   
   ### Expected Behavior
   正常返回
   
   <!-- What do you expect from the above steps?-->
   
   ### Actual Behavior
   提供者找不到对应方法
   
   
   原因分析:
   org.apache.dubbo.rpc.protocol.tri.TripleInvoker#invokeUnary 
里面使用org.apache.dubbo.rpc.support.RpcUtils#getParameterTypes获取实际参数类型
   public static Class<?>[] getParameterTypes(Invocation invocation) {
           if ($INVOKE.equals(invocation.getMethodName())
               && invocation.getArguments() != null
               && invocation.getArguments().length > 1
               && invocation.getArguments()[1] instanceof String[]) {
               String[] types = (String[]) invocation.getArguments()[1];
               if (types == null) {
                   return new Class<?>[0];
               }
               Class<?>[] parameterTypes = new Class<?>[types.length];
               for (int i = 0; i < types.length; i++) {
                   parameterTypes[i] = ReflectUtils.forName(types[i]);
               }
               return parameterTypes;
           }
           return invocation.getParameterTypes();
       }
   如果传的是null,则  invocation.getArguments()[1] instanceof 
String[]不会成立,导致返回的实际参数类型泛型的参数类型 [String, Ljava.lang.String, Ljava.lang.Object]
   
   提供者收到的请求如下图,
   
![image](https://github.com/apache/dubbo/assets/7105269/5f1e7dcd-60be-4eaa-864a-f8290b74a187)
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to