Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvokeTelnetHandler.findMethod 关于重载逻辑有问题 #257

Closed
micelife opened this issue Jun 13, 2016 · 3 comments
Closed

InvokeTelnetHandler.findMethod 关于重载逻辑有问题 #257

micelife opened this issue Jun 13, 2016 · 3 comments

Comments

@micelife
Copy link

micelife commented Jun 13, 2016

这里如果有重载方法,判断之前的方法是否匹配,如果匹配,应该break,否则赋值,继续看下一个重载方法。
这个会导致测试的时候,用telnet invoke方式,重载方法测不了(不能正确匹配方法)

建议修正如下:

if (m.getName().equals(method) && m.getParameterTypes().length == args.size()) {
                if (invokeMethod != null) { // 重载
                    if (isMatch(invokeMethod.getParameterTypes(), args)) {
                        break;
                    }
                }
                invokeMethod = m;
                invoker = exporter.getInvoker();
            }
@beiwei30
Copy link
Member

27917f2 fixed this issue.

@micelife
Copy link
Author

能区分 enum 和 string 嘛,这两种重载的话,可能区分不了

@qixiaobo
Copy link
Contributor

qixiaobo commented Jul 13, 2019

能区分 enum 和 string 嘛,这两种重载的话,可能区分不了

我理解如果重载的话带来的问题比较多 其实比如retry timeout 这些参数都可以定义在方法级别上面 如果这样的话 其实我们在调用的过程中 dubbo拼接url都会去除重复项 这样很有可能导致你的配置其实不是你的预期

举个例子
a(String xxx)
a(enum xxx)
虽然在java中允许 但是我们分别给两个方法定义超时和重试等在url上只会有一个比如a.retry=1
所以其实这种问题 我反而觉得不需要对应
dubbo 为了对应这个问题 反而导致任意复杂对象方法在dubbo telnet中不可以解析 毕竟json parse无法携带对象类型 #2801 但是从理解上应当尽量避免出现此问题 还是少用重载比较好

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants