Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove type parameter from Choice #868

Merged
merged 1 commit into from
Sep 17, 2023
Merged

Remove type parameter from Choice #868

merged 1 commit into from
Sep 17, 2023

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
6 checks passed
@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