-
Notifications
You must be signed in to change notification settings - Fork 620
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
Experimental support for inline classes #1244
Conversation
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.
It currently supports unsigned types only for JSON format.
formats/json/commonTest/src/kotlinx/serialization/features/inline/InlineClassesCompleteTest.kt
Show resolved
Hide resolved
bcd0b93
to
e5bdea8
Compare
core/commonMain/src/kotlinx/serialization/descriptors/SerialDescriptor.kt
Outdated
Show resolved
Hide resolved
core/commonMain/src/kotlinx/serialization/descriptors/SerialDescriptor.kt
Outdated
Show resolved
Hide resolved
core/commonMain/src/kotlinx/serialization/internal/InlineClassDescriptor.kt
Outdated
Show resolved
Hide resolved
core/commonMain/src/kotlinx/serialization/internal/PluginGeneratedSerialDescriptor.kt
Outdated
Show resolved
Hide resolved
formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt
Outdated
Show resolved
Hide resolved
formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt
Outdated
Show resolved
Hide resolved
formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonEncoder.kt
Show resolved
Hide resolved
791f222
to
38f5b3b
Compare
|
||
```kotlin | ||
object UIDSerializer: KSerializer<UID> { | ||
override val descriptor = UInt.serializer().descriptor |
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.
Here we lack analogue of PrimitiveClassDescriptor
core/commonMain/src/kotlinx/serialization/internal/EmptyEncoder.kt
Outdated
Show resolved
Hide resolved
core/commonMain/src/kotlinx/serialization/internal/EmptyEncoder.kt
Outdated
Show resolved
Hide resolved
import kotlin.test.* | ||
|
||
@Serializable | ||
data class SimpleContainerForUInt(val i: UInt) |
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.
These classes can be moved into InlineClassesTest
, can't they?
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.
'Inline classes are only allowed on top level' says Kotlin compiler
formats/json/commonTest/src/kotlinx/serialization/features/inline/InlineClassesCompleteTest.kt
Show resolved
Hide resolved
formats/json/commonTest/src/kotlinx/serialization/features/inline/EncodeInlineElementTest.kt
Show resolved
Hide resolved
formats/json/commonMain/src/kotlinx/serialization/json/internal/TreeJsonEncoder.kt
Outdated
Show resolved
Hide resolved
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.
Nice, great job!
Serializer for UInt, handling UInt in JSON
Support all unsigned types for streaming and tree Json (excecpt for ULong)
Bump version
…not the source set
…l/TreeJsonEncoder.kt Co-authored-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
4e0268a
to
62cae74
Compare
@Serializable inline class
with generated (requires 1.4.30 IR compiler) and custom serializers