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

实际应用中采用Kotlin的时候出错,因为Kotlin代码的接口方法不支持default关键字 #154

Open
wunglee opened this issue May 3, 2024 · 1 comment

Comments

@wunglee
Copy link

wunglee commented May 3, 2024

如下代码pro.chenggang.project.reactive.mybatis.support.r2dbc.binding.MapperProxy中的cachedInvoker方法,会在实际应用中采用Kotlin的时候出错,因为Kotlin代码的接口方法不支持default关键字,于是:

private MapperMethodInvoker cachedInvoker(Method method) throws Throwable {
    try {
        return (MapperMethodInvoker)MapUtil.computeIfAbsent(this.methodCache, method, (m) -> {
            if (m.isDefault()) {
                       ......//由于Java代码的接口方法支持default关键字,此处为true,进入正确分支。
            } else {
                      ......//由于Kotlin代码的接口方法不支持default关键字,此处为false,进入错误分支。
            }
        });
    } catch (RuntimeException var4) {
                     ......
    }
}
@chenggangpro
Copy link
Owner

chenggangpro commented May 4, 2024

这里和Mybatis3的源码一致,没有做过太多改动的。只有Mybatis-Dynamic-SQL相关的Kotlin Reactive化这里是没有支持的

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

2 participants