I'm wondering how to implement this in Kotlin
@Headers({
"Accept: application/vnd.github.v3.full+json",
"User-Agent: Retrofit-Sample-App"
})
Regards
Does arrayOf not work?
This issue tracker works best for bugs with test cases and feature requests.
StackOverflow has people who can answer usage questions about Kotlin, Retrofit, etc.
It doesn't, it complains about requiring String but Array
Thanks
arrayOf will work. If not it's a Kotlin bug. See https://kotlinlang.org/docs/reference/annotations.html#java-annotations.
Kotlin seems to understand Java arrays in annotations as varargs. (filed as possible bug: https://youtrack.jetbrains.com/issue/KT-20691)
@Headers(
"Accept: application/vnd.github.v3.full+json",
"User-Agent: Retrofit-Sample-App"
)
(not arrayOf)
in Kotlin will work.
Most helpful comment
Kotlin seems to understand Java arrays in annotations as varargs. (filed as possible bug: https://youtrack.jetbrains.com/issue/KT-20691)
(not
arrayOf)in Kotlin will work.