This repository has been archived by the owner on Mar 18, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a small compiler plug-in that generates a serializer for a given class with a single
val
argument in the primary constructor which will serialize the class inline. This is typically something that you may want withdata class
es of this kind:data class TimeSec(val value : Double)
An instance of this class would be serialized to JSON as something like
{ "value": 4.5 }
Marking the class with
@InlineSerializable
will cause this compiler plug-in to generate a serializer that will serialize the same object as4.5
The serializer is also associated with the class.
Note that, while
data class
es of this kind are obvious candidates for beinginline class
es, currently Kotlin does not support serialization ofinline class
es. In my case, this means that I have a plethora ofdata class
es waiting to be converted toinline class
es as soon as that limitation is removed.Feel free to include this example in your repository, if you find any value in it.
This is my first pull request. I'm at your disposal, in case you need any changes.