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

In order to support multiple parameters of lambda, is this too compli… #37

Merged
merged 1 commit into from
Sep 27, 2020

Conversation

guoyu09403
Copy link
Contributor

之前提交的lambda方法引用只能处理单个参数,为了支持多参数方法引用,参考了一下scala的Function相关实现,感觉实现方式上不太优雅,从使用的角度感觉也不是特别友好,但从学习的角度还可以。

…cated? See ServiceTest2 for details. In addition, the getClassType method under ObjectProxy has a BUG, ​​ReferenceType.TYPE would return PrimitiveType, which will cause the reflection of the method to fail.
@luxiaoxun
Copy link
Owner

我先merge进来,但是感觉为了client调用,做的有点复杂了。现在是支持2个参数,那每多支持一个,就要写一个RpcFunction

@luxiaoxun luxiaoxun merged commit 8b0a13c into luxiaoxun:master Sep 27, 2020
@guoyu09403
Copy link
Contributor Author

写这套实现之前我也发现客户端不太对友好,方法引用我还没找到可以通用的实现方式,我再想想这个PR 。

@@ -117,26 +116,6 @@ private RpcRequest createRequest(String className, String methodName, Object[] a

private Class<?> getClassType(Object obj) {
Class<?> classType = obj.getClass();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个地方,其实有个问题:就是服务端接口定义的时候是Integer,而客户端调用的时候如果传的是int,是匹配不上的。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

从jdk相关反射显示上来看,func(Integer i) 跟func(int i) 这是两个方法,所以如果服务端跟客户端方法签名不一致会导致服务端找不到调用方法。

@luxiaoxun
Copy link
Owner

我把你的代码,整理了下,麻烦合并下最新的代码,再修改。

@guoyu09403
Copy link
Contributor Author

我把你的代码,整理了下,麻烦合并下最新的代码,再修改。

抱歉,之前没参与过Github上的开源项目,导致commit提交记录可能比较混乱。

@luxiaoxun
Copy link
Owner

在你fork后的项目,“Pull request”里,点击“New pull request”,这里你就可以“Comparing changes”,然后merge和原始project的任何分支的区别

@guoyu09403
Copy link
Contributor Author

好的,如果后续关于方法引用有更优雅的调用方式,我合并后再提交。

@luxiaoxun
Copy link
Owner

好的,如果后续关于方法引用有更优雅的调用方式,我合并后再提交。

fork后和原有project改动同步,参考:https://www.cnblogs.com/guors/p/10938035.html
一起交流学习。

@guoyu09403
Copy link
Contributor Author

好的,如果后续关于方法引用有更优雅的调用方式,我合并后再提交。

fork后和原有project改动同步,参考:https://www.cnblogs.com/guors/p/10938035.html
一起交流学习。

好的,非常感谢!

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

Successfully merging this pull request may close these issues.

2 participants