question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sealed class serializer needs access to KClass.serializer(), marked @InternalSerializationApi

See original GitHub issue

What is your use-case and why do you need this feature? I just updated to 1.0.0-RC and now I’m getting this error: This declaration is experimental and its usage must be marked with '@kotlinx.serialization.InternalSerializationApi' or '@OptIn(kotlinx.serialization.InternalSerializationApi::class)' I can add languageSettings.useExperimentalAnnotation("kotlinx.serialization.InternalSerializationApi") for now, but I’d like some more clarity on why this method has been marked internal. I’m doing something that doesn’t seem that crazy to me and seems like it should be supported.

Here’s the repro project branch: https://github.com/edenman/kmpPlayground/compare/edenman/kupdates And the problematic call: https://github.com/edenman/kmpPlayground/blob/edenman/kupdates/shared/src/commonMain/kotlin/chat/quill/data/OneOfSerializer.kt#L30

Describe the solution you’d like A non-internal way to get serializers from a list of KClass instances

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
qwwdfsadcommented, Aug 25, 2020

@edenman sure! We realize that typeOf approach is not always available, that’s why we left kClass.serializer. It can be okay sometimes, but we really want to discourage its usages when possible and give a clear understanding of why this method is potentially dangerous and marked as Internal

1reaction
rjaroscommented, Aug 24, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

It is safe to use KClass<T>.serializer() even if is internal?
I'm working on a Multiplatform project and I'm building a custom serializer for Alamofire to deserialize a json to a Kotlin Class.
Read more >
Obtaining serializer from KClass is not available on native due ...
I'm using Kotlinx serialization library in a multiplatform library for iOS and Android to handle HTTP requests. But I have this message when...
Read more >
Using a KClass reference as a reified parameter to deserialize ...
I'm trying to implement a general serialization framework to convert outgoing and incoming messages to json using the kotlinx ...
Read more >
kclass | Component inheritance and event mechanism - kandi
kclass is a JavaScript library. kclass has no vulnerabilities and it has low support. ... val serializer = this::class.serializer() as KSerializer<Any?> ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found