https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
a

andreasmattsson

04/24/2018, 3:02 PM
would anyone be able to assist me in figuring out what my
expect
declaration should look like in order to be able to use the following (delegating to Gson) type annotation on my (cross-platform/shared) data models:
Copy code
actual typealias SerializedName = com.google.gson.annotations.SerializedName
this:
Copy code
expect annotation class SerializedName(val value: String, val alternate: Array<String> = [])
results in error:
Parameter 'alternate' has conflicting values in the expected and actual annotation
that syntax is what the java source of the gson class gets converted to by the IDE if I copy paste it (except with
arrayOf()
instead of
[]
, but it doesn't make a difference and the linter suggests changing it to
[]
)
g

Gabriel Ittner

04/24/2018, 3:27 PM
Sounds like you're running into https://youtrack.jetbrains.com/issue/KT-22704
a

andreasmattsson

04/24/2018, 3:35 PM
Ah, that does indeed seem to be the case! Thank you! Well, at least it appears I can get around it for now by annotating my classes with
@SerializedName("value", [])
. Ugly, but works.
4 Views