I'm trying to implement the example from here in Kotlin. I get this error at runtime "Caused by: java.lang.IllegalArgumentException: Interface definitions must not extend other interfaces". Is there any way to treat Kotlin traits as java interfaces when they don't have any methods implemented, or do I have to use java interfaces? Here's the code:
public trait RestAPI {
[GET("/weather")]
fun getList([Query("q")] place: String,
[Query("units")] units: String)
: Observable<WeatherData>
}
And the call that causes the error:
val service = restAdapter?.create(javaClass<RestAPI>())
This issue has been fixed. I am using Retrofit implemented exactly this way with Kotlin version 0.9.976.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With