dubbo
dubbo copied to clipboard
Not compatible with Kotlin's unchecked exception?
Environment
- Dubbo version: xxx
- Operating System version: Mac OS X 10.14.3
- Java version: 1.8.0_202
Steps to reproduce this issue
- Kotlin integrated dubbo provider throws custom exceptions

- 由于Kotlin中没有受检的异常
// provider impl
fun createUser(user: User):User {
// ...
if(user.exited) {
throws CustomException("user exited")
}
// ...
}
// consumer
try {
userService.createUser(user)
} catch (ex: Exception) {
logger.debug(ex) { "${ex.javaClass}" } // expected CustomException,actual UndeclaredThrowableException
}
java.lang.reflect.UndeclaredThrowableException: null
at com.sun.proxy.$Proxy120.signup(Unknown Source) ~[na:na]
Since I am using kotlin, all can't declare an exception on the interface method like java. I tried kotlin to call java method and declare @Thtows(CustomException::class), this can't solve my problem.
It's an issue on Dubbo 2.6.5, please wait for 2.6.6 release to resolve this problem.