-
Notifications
You must be signed in to change notification settings - Fork 627
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
Add build-time check for Kotlin compiler version and kotlinx.serialization plugin version compatibility #2393
Comments
(initially brought up internally at https://jetbrains.slack.com/archives/C2WQKN6JV/p1690982388347429). |
I ran into a similar issue and couldn't find an update for it. Any progress on this? |
That's exactly why I landed here, was going to rebuild the demo project "my-bird" with Sebastian's Youtube video and googled for the error |
This should probably be done in the compiler plugin (which I believe still uses youtrack) |
open -> gradle.properties and check Kotlin version Like this kotlin.version=1.9.10 this version must same here |
@Ahtisham80005 If you want to check this in gradle this would need to be done a bit more complex than looking at gradle.properties (there is no requirement to use that). The bigger challenge is to ensure that the library version is high enough that the plugin supports it. |
Will be fixed by #2797 |
What is your use-case and why do you need this feature?
Using incompatible versions between the Kotlin compiler and kotlinx.serialization plugin can result in obscure errors.
We recently encountered this in SebastianAigner/my-bird-app#2, which is a demo project accompanying one of our official YouTube videos:
While the video was using Kotlin 1.8.20, the template used was since been updated to Kotlin 1.9. Because at the time of writing, the installation snippets in the kx.serialization README still point to 1.8.20, it's easy to accidentally copy the wrong installation snippet, and end up in situations where you get error messages like
io.ktor.serialization.JsonConvertException: Illegal input: Expected class kotlinx.serialization.json.JsonObject as the serialized body of kotlinx.serialization.Polymorphic<List>, but had class kotlinx.serialization.json.JsonArray
.Describe the solution you'd like
Build-time version equality check between the Kotlin and kx.serialization compiler plugin versions, and an error that contains information / instructions on how to address this (update the kx.serialization compiler plugin version).
The text was updated successfully, but these errors were encountered: