-
Notifications
You must be signed in to change notification settings - Fork 630
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
Introduce @SealedSerializationApi to codebase and stabilize part of SerialDescriptor's API #2827
Conversation
Build with Kotlin master failed because of Kotlin/dokka#3851 |
* Yet it is not type-checked statically, thus making it possible to declare a non-consistent implementations of descriptor and serializer. | ||
* In such cases, the behaviour of an underlying format is unspecified and may lead to both runtime errors and encoding of | ||
* Yet it is not type-checked statically, thus making it possible to declare a non-consistent implementation of descriptor and serializer. | ||
* In such cases, the behavior of an underlying format is unspecified and may lead to both runtime errors and encoding of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use both options, is this change definitely necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC general doc guideline dictates the usage of American English, so all spelling should be converted to this one eventually
core/commonMain/src/kotlinx/serialization/descriptors/SerialDescriptor.kt
Show resolved
Hide resolved
core/commonMain/src/kotlinx/serialization/descriptors/SerialDescriptor.kt
Show resolved
Hide resolved
This API has been around for a long time and has proven itself useful. The main reason @ExperimentalSerializationApi was on SerialDescriptor's properties is that we wanted to discourage people from subclassing it. With the introduction of @SubclassOptInRequired (#2366), we can do this without the need of marking everything with experimental. Serial kinds fall into the same category with only exception in PolymorphicKind. There are plenty requests for functionality like creating a custom sealed-like descriptor (#2697, #2721, #1865) which may require additional kinds in the future.
and allow creating primitive descriptors via it as well. This constructor function is a way to create a descriptor for your custom serializer if it simply delegates to an existing one. Since it fits its purpose and is unlikely to change in the future, we can promote it to stable API alongside other descriptor builders. Fixes #2547
to be used with @SubclassOptInRequired. This annotation allows for even more fine-grained API marking. We now can designate APIs as public for use, but closed for implementation — the case for SerialDescriptor, which is a non-sealed interface for technical reasons.
aed3864
to
4e7eed3
Compare
Same as #2764 but without
@AdvancedEncodingApi
. It seems that https://youtrack.jetbrains.com/issue/KTIJ-30831 is fixed only in K2 IDE and only in Kotlin 2.1, so introducing@AdvancedEncodingApi
now may lead to poor UX for 3rd party format authors