Guodong, Would you mind to file an issue against your findings and suggestions? You could either assign it to me (@beiwei30) or Zhen (@LiZhenNet).
Thanks, -Ian. On Wed, Jan 9, 2019 at 12:01 PM zgd <[email protected]> wrote: > 建议: > 当存在重载方法时: > 1、如果重载方法参数长度不同,则可以正常匹配 > 2、当存在重载方法参数长度相同时,给用户提示,必须传入class参数 > Google Translation: > Suggest: > When there is an overloaded method: > As shown in Figure 1, if the overload method parameters have different > lengths, they can match normally. > 2, when there are overloaded method parameters with the same length, prompt > the user, you must pass in the class parameters > > 章国东 <[email protected]> 于2019年1月9日周三 上午11:48写道: > > > 新版本还是有问题,在没有传递class参数时,重载还是会调错方法 > > ((JSONObject) arg).toJavaObject(type); > > 这句话不管属性是否匹配,都能转换成功,没有太大的意义。 > > 我在DemoService添加一个方法 > > String getPerson(Yee yee); > > > > public class Yee implements Serializable { > > private String address; > > > > public String getAddress() { > > return address; > > } > > > > public void setAddress(String address) { > > this.address = address; > > } > > } > > > > UT: > > @Test > > public void testInvokeMultiJsonParamMethod2() throws > RemotingException > > { > > mockChannel = mock(Channel.class); > > > given(mockChannel.getAttribute("telnet.service")).willReturn(null); > > > > given(mockChannel.getLocalAddress()).willReturn(NetUtils.toAddress(" > > 127.0.0.1:5555")); > > > > given(mockChannel.getRemoteAddress()).willReturn(NetUtils.toAddress(" > > 127.0.0.1:20886")); > > > > ProviderModel providerModel = new > > ProviderModel("org.apache.dubbo.rpc.protocol.dubbo.support.DemoService", > > new DemoServiceImpl(), DemoService.class); > > > > > ApplicationModel.initProviderModel("org.apache.dubbo.rpc.protocol.dubbo.support.DemoService", > > providerModel); > > String param = "{\"address\":\"Dubbo\"}"; > > String result = invoke.telnet(mockChannel, "getPerson(" + param + > > ")"); > > assertTrue(result.contains("result: \"Dubbo")); > > } > > 无法测试成功,他会调用String getPerson(Man man);方法 > > > > LiZhenNet <[email protected]> 于2019年1月9日周三 上午11:24写道: > > > >> Yes ,I have added UT to cover this。 > >> > >> Ian Luo <[email protected]> 于2019年1月9日周三 上午10:57写道: > >> > >> > I see. I have not considered the overridden scenario carefully. Thanks > >> for > >> > your clarification. BTW, do we have the corresponding unit test to > cover > >> > this? > >> > > >> > Thanks, > >> > -Ian. > >> > > >> > > >> > On Tue, Jan 8, 2019 at 5:50 PM LiZhenNet <[email protected]> > wrote: > >> > > >> > > @beiwei30 > >> > > > >> > > I think your suggestion maybe not right, I have added a comment > >> ,please > >> > > take a look. > >> > > > >> > > >> > > >
