-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
java.lang.ClassCastException: class kotlin.Result cannot be cast to class java.lang.String (kotlin.Result is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap') #3403
Comments
Could you please specify Kotlin version you are using and provide the whole stacktrace? |
Sry, here we go: (Retrofit 2.9.0 and OkHttp 4.10.0) |
@papo2608 Can you attach a sample project and the whole stacktrace? |
@ivakub sure
|
@papo2608 Thank you! This is a bug in the backend. I created an issue — https://youtrack.jetbrains.com/issue/KT-53559/JVM-ClassCastException-class-kotlinResult-cannot-be-cast-to-class-javalangString-with-Retrofit. Feel free to follow it. |
how to fix this the issue |
In my code I was getting this issue, My functions were |
With following sample code I get above error when kotlin.Result is used with a suspend function and a runtime exception is thrown in the Retrofit call factory - this works though with e.g. sealed or data classes.
I'm not sure what the root cause here is.
The text was updated successfully, but these errors were encountered: