-
Notifications
You must be signed in to change notification settings - Fork 623
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
Optimize check for missing fields in deserialization #1153
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.
Do you have any tests for that? I know they would fail on buildserver and pass only locally, but that's ok for now (we can depend on -dev- version of compiler later)
core/commonMain/src/kotlinx/serialization/SerializationException.kt
Outdated
Show resolved
Hide resolved
core/commonMain/src/kotlinx/serialization/internal/PluginUtils.kt
Outdated
Show resolved
Hide resolved
core/commonMain/src/kotlinx/serialization/internal/PluginUtils.kt
Outdated
Show resolved
Hide resolved
Now optimization turned off in compiler plugin to prevent fails. Anyway, the plugin should be improved |
915374a
to
b96fe88
Compare
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.
LGTM (modulo comments)
Seems that we have to merge this somewhere around after 1.4.20 (so we can raise min version to 30)
SerializationException("Field '$fieldName' is required, but it was missing") | ||
internal class MissingFieldException : SerializationException { | ||
// TODO: add (message, cause) ctor after 1.4.20 for coroutines stacktrace recovery | ||
constructor(fieldName: String) : super("Field '$fieldName' is required, but it was missing") |
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.
The error in build is caused by the fact that old plugins can't find primary constructor of this class (because now it has two secondary constructors). In 1.4.20 this problem is fixed, so you may try to bump kotlin version to 1.4.20-M2
core/commonMain/src/kotlinx/serialization/SerializationException.kt
Outdated
Show resolved
Hide resolved
formats/json/jvmTest/src/kotlinx/serialization/JvmMissingFieldsExceptionTest.kt
Outdated
Show resolved
Hide resolved
834dd3b
to
5516e6d
Compare
5516e6d
to
ecb852b
Compare
3a13bf6
to
2f8de1f
Compare
@@ -2,7 +2,7 @@ | |||
# Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | |||
# | |||
|
|||
mainKotlinVersion=1.4.10 | |||
mainKotlinVersion=1.4.30-M1 |
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.
Don't forget to change mainLibVersion
to 1.1.0-SNAPSHOT
so your optimizations will be enabled
2f8de1f
to
b6298de
Compare
b6298de
to
4d912ec
Compare
No description provided.