Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lukellmann
Copy link
Member

Because Choice was generic, something like the following could happen:

val choice: Choice<String> = Json.decodeFromString(
    Choice.serializer(String.serializer()),
    string = "{\"name\":\"name\",\"value\":1234}",
)
val value: String = choice.value // ClassCastException

Apart from this, the type parameter wasn't really useful since it was only used in one place.

Therefore, the type parameter was removed from Choice and its usages.

Because Choice was generic, something like the following could happen:

val choice: Choice<String> = Json.decodeFromString(
    Choice.serializer(String.serializer()),
    string = "{\"name\":\"name\",\"value\":1234}",
)
val value: String = choice.value // ClassCastException

Apart from this, the type parameter wasn't really useful since it was
only used in one place.

Therefore, the type parameter was removed from Choice and its usages.
@DRSchlaubi DRSchlaubi merged commit 2dad036 into main Sep 17, 2023
@DRSchlaubi DRSchlaubi deleted the non-generic-choice branch September 17, 2023 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants