这个问题是这个PR引入 
https://github.com/apache/incubator-dubbo/commit/27917f2e86bbd97ee047d69817730a57bdf5ad6b
2.5.3
```java
    private static Method findMethod(Exporter<?> exporter, String method, 
List<Object> args) {
        Invoker<?> invoker = exporter.getInvoker();
        Method[] methods = invoker.getInterface().getMethods();
        Method invokeMethod = null;
        for (Method m : methods) {
            if (m.getName().equals(method) && m.getParameterTypes().length == 
args.size()) {
                if (invokeMethod != null) { // 重载
                    if (isMatch(invokeMethod.getParameterTypes(), args)) {
                        invokeMethod = m;
                        break;
                    }
                } else {
                    invokeMethod = m;
                }
                invoker = exporter.getInvoker();
            }
        }
        return invokeMethod;
    }
```
之后版本:
```java
   private static Method findMethod(Exporter<?> exporter, String method, 
List<Object> args) {
        Invoker<?> invoker = exporter.getInvoker();
        Method[] methods = invoker.getInterface().getMethods();
        for (Method m : methods) {
            if (m.getName().equals(method) && isMatch(m.getParameterTypes(), 
args)) {
                return m;
            }
        }
        return null;
    }
```
新版本导致都会执行`isMatch`,这个方法里面有个逻辑,(ps:telnet传入json格式经过fastjson反序列化后是JsonObject,都会执行下面代码)
```java
else if (arg instanceof Map) {
                String name = (String) ((Map<?, ?>) arg).get("class");
                Class<?> cls = arg.getClass();
                if (name != null && name.length() > 0) {
                    cls = ReflectUtils.forName(name);
                }
                if (!type.isAssignableFrom(cls)) {
                    return false;
                }
            }
```
当用户没有传`class`时,clz就是JsonObject.class 
导致直接返回false,最终在不传class时,会匹配不到方法,telnet直接会返回找不到方法;之前老代码在调用重载方法时,用户需要传入class进行参数类型判断,无重载方法时无需传入class;PR这样改正之后,导致所有telnet都必须传入class

[ Full content available at: 
https://github.com/apache/incubator-dubbo/issues/3105 ]
This message was relayed via gitbox.apache.org for 
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to