retrofit
retrofit copied to clipboard
Bug: While debugging, stuck on "collecting data...", eventually can reach StackOverflow
What kind of issue is this?
- [ V] Bug report. If you’ve found a bug, spend the time to write a failing test. Bugs with tests get fixed. Here’s an example: https://gist.github.com/swankjesse/6608b4713ad80988cdc9
https://i.imgur.com/SCEL7K2.png
I use Kotlin with Retrofit, on Android Studio. This is what I have in gradle file:
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.okhttp3:okhttp:4.8.1'
implementation 'com.squareup.okhttp3:logging-interceptor:4.8.1'
I wanted to debug and see there the response body, to check on its fields.
Basically the response is set as such:
data class BaseDCResponse(
@SerializedName("error_code") var errorCode: Int,
@SerializedName("error_description") var errorDescription: String?
) {
fun isSuccess() = errorCode == 0
}
But when I try to reach "errorCode" for example, it gets stuck on "collecting data" and might eventually reach "java.lang.StackOverflowError" (I did it by using a watch of body?.errorCode .
Please fix this, or if you know why this occurs, please let me know what I did wrong.
What makes you think this is a Retrofit bug?
@JakeWharton Could be Kotlin or Android-Studio or IntelliJ too, that's right. It's the first time I see this issue, only on this library, so this is why I wrote here. Maybe it somehow reaches an infinite recursion for some reason during debug, but when printing to logs it seems fine.
If you know why this occurs, please let me know. I didn't find yet what could be the reason.
I don't know what action to take here. We're not really involved in how tooling handles our code. Without some clear indication of something we've done to cause this I don't think we have anything to do on our side.