-
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
Annotating property type with @Serializable does not override default serialzer #1895
Comments
Target But I agree it should also work in a described way. However, probably not with |
This indeed works as intended.
Since the |
I further found out that this seems to be only the case for serializable classes that use a custom serializer and not the generated one. If @Serializable(with = SomeCustomSerializer::class)
data class SomeClass(val data: Int) and @Serializable
data class SomeClass(val data: Int) I can no longer observe this bug. custom serializersobject SomeCustomSerializer : KSerializer<SomeClass> {
override val descriptor = PrimitiveSerialDescriptor("SomeClass", PrimitiveKind.STRING)
override fun serialize(encoder: Encoder, value: SomeClass) {
encoder.encodeString(value.data.toString())
}
override fun deserialize(decoder: Decoder): SomeClass {
return SomeClass(decoder.decodeString().toInt())
}
}
object OverrideSerializer : KSerializer<SomeClass> {
override val descriptor = PrimitiveSerialDescriptor("SomeClassAsAlwaysTheSame", PrimitiveKind.STRING)
override fun serialize(encoder: Encoder, value: SomeClass) {
encoder.encodeString("AlwaysTheSame");
}
override fun deserialize(decoder: Decoder): SomeClass {
decoder.decodeString()
return SomeClass(1)
}
} |
* Instant serializers * use Instant for UpdateStatus.since * use Instant for Activity timestamps * use Instant for Typing Start timestamps * use Instant for request_to_speak_timestamp * use Instant for DiscordTemplate * use Instant for last_pin_timestamp * use Instant for Message timestamps * use Instant for archive_timestamp * use Instant for join_timestamp * use Instant for Embed.timestamp * use Instant for joined_at * use Instant for premium_since * use Instant for synced_at * use Instant for DiscordCreatedInvite.createdAt * fix tests * typealiases * more and simpler tests * throw SerializationException on overflow in InstantInEpochMillisecondsSerializer * Range check to prevent false positive * Don't use typealiases because of Kotlin/kotlinx.serialization#1895
Do you think I could contribute a fix myself? |
Plugin sources are located in the Kotlin repository: https://github.com/JetBrains/kotlin/tree/master/plugins/kotlin-serialization/kotlin-serialization-compiler (ignore the README though, it's outdated since all Kotlin idea plugins are now in intellij monorepo). It may be hard to get a grasp on large compiler API, but of course, nothing is impossible :) |
In `val p: @serializable(X) Foo` and `@Serializable(Y) class Foo` situation, now X would be chosen as serializer. Fixes Kotlin/kotlinx.serialization#1895
It seems like you did some work related to this issue @sandwwraith. Will this be fixed now in some next version? |
@lukellmann Yes, the fix should go to the |
That's amazing, thanks :) |
In `val p: @serializable(X) Foo` and `@Serializable(Y) class Foo` situation, now X would be chosen as serializer. Fixes Kotlin/kotlinx.serialization#1895
In `val p: @serializable(X) Foo` and `@Serializable(Y) class Foo` situation, now X would be chosen as serializer. Fixes Kotlin/kotlinx.serialization#1895
In `val p: @serializable(X) Foo` and `@Serializable(Y) class Foo` situation, now X would be chosen as serializer. Fixes Kotlin/kotlinx.serialization#1895
Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.20-Beta, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.20-Beta. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.20-Beta, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.20-Beta. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.20-Beta, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.20-Beta. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.20-RC, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.20-RC. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.20-RC, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.20-RC. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
* Kotlin 1.8.10 -> 1.8.20-RC * KSP 1.8.10-1.0.9 -> 1.8.20-RC-1.0.9 * kotlinx.coroutines 1.6.4 -> 1.7.0-Beta Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.20-RC, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.20-RC. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
* Kotlin 1.8.10 -> 1.8.20-RC * KSP 1.8.10-1.0.9 -> 1.8.20-RC-1.0.9 * kotlinx.coroutines 1.6.4 -> 1.7.0-Beta Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.20-RC, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.20-RC. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
* Kotlin 1.8.10 -> 1.8.20-RC2 * KSP 1.8.10-1.0.9 -> 1.8.20-RC2-1.0.9 * kotlinx.coroutines 1.6.4 -> 1.7.0-Beta * AtomicFU 0.20.0 -> 0.20.1 Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.20-RC2, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.20-RC2. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
* Kotlin 1.8.10 -> 1.8.20 * KSP 1.8.10-1.0.9 -> 1.8.20-RC2-1.0.9 * kotlinx.coroutines 1.6.4 -> 1.7.0-Beta * AtomicFU 0.20.0 -> 0.20.1 Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.20, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.20. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
* Kotlin 1.8.10 -> 1.8.20 * KSP 1.8.10-1.0.9 -> 1.8.20-1.0.10 * kotlinx.coroutines 1.6.4 -> 1.7.0-Beta * AtomicFU 0.20.0 -> 0.20.1 Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.20, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.20. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
* Kotlin 1.8.10 -> 1.8.20 * KSP 1.8.10-1.0.9 -> 1.8.20-1.0.10 * kotlinx.coroutines 1.6.4 -> 1.7.0-Beta * AtomicFU 0.20.0 -> 0.20.1 Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.20, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.20. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
* Kotlin 1.8.10 -> 1.8.20 * KSP 1.8.10-1.0.9 -> 1.8.20-1.0.10 * kotlinx.coroutines 1.6.4 -> 1.7.0-Beta * AtomicFU 0.20.0 -> 0.20.2 * KotlinPoet 1.12.0 -> 1.13.0 Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.20, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.20. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
* Kotlin 1.8.10 -> 1.8.20 * KSP 1.8.10-1.0.9 -> 1.8.20-1.0.10 * kotlinx.coroutines 1.6.4 -> 1.7.0-Beta * AtomicFU 0.20.0 -> 0.20.2 * KotlinPoet 1.12.0 -> 1.13.0 Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.20, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.20. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
* Kotlin 1.8.10 -> 1.8.20 * KSP 1.8.10-1.0.9 -> 1.8.20-1.0.10 * kotlinx.coroutines 1.6.4 -> 1.7.0-Beta * AtomicFU 0.20.0 -> 0.20.2 * KotlinPoet 1.12.0 -> 1.13.0 Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.20, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.20. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
* Kotlin 1.8.10 -> 1.8.20 * KSP 1.8.10-1.0.9 -> 1.8.20-1.0.11 * kotlinx.coroutines 1.6.4 -> 1.7.0-RC * AtomicFU 0.20.0 -> 0.20.2 * Binary compatibility validator 0.13.0 -> 0.13.1 * KotlinPoet 1.12.0 -> 1.13.0 * MockK 1.13.4 -> 1.13.5 Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.20, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.20. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
* Kotlin 1.8.10 -> 1.8.20 * KSP 1.8.10-1.0.9 -> 1.8.20-1.0.11 * Ktor 2.2.4 -> 2.3.0 * kotlinx.coroutines 1.6.4 -> 1.7.0-RC * AtomicFU 0.20.0 -> 0.20.2 * Binary compatibility validator 0.13.0 -> 0.13.1 * KotlinPoet 1.12.0 -> 1.13.0 * MockK 1.13.4 -> 1.13.5 Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.20, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.20. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
* Kotlin 1.8.10 -> 1.8.21 * Ktor 2.2.4 -> 2.3.0 * kotlinx.coroutines 1.6.4 -> 1.7.0-RC * kotlin-node 18.14.0-pre.502 -> 18.16.0-pre.543 * KSP 1.8.10-1.0.9 -> 1.8.20-1.0.11 * KotlinPoet 1.12.0 -> 1.13.0 * MockK 1.13.4 -> 1.13.5 * AtomicFU 0.20.0 -> 0.20.2 * Binary compatibility validator 0.13.0 -> 0.13.1 * gradle-buildconfig-plugin 3.1.0 -> 4.0.2 Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.21, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.21. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
* Kotlin 1.8.10 -> 1.8.21 * Ktor 2.2.4 -> 2.3.0 * kotlinx.coroutines 1.6.4 -> 1.7.0-RC * kotlin-node 18.14.0-pre.502 -> 18.16.0-pre.543 * KSP 1.8.10-1.0.9 -> 1.8.21-1.0.11 * KotlinPoet 1.12.0 -> 1.13.0 * JUnit 5 5.9.2 -> 5.9.3 * MockK 1.13.4 -> 1.13.5 * AtomicFU 0.20.0 -> 0.20.2 * Binary compatibility validator 0.13.0 -> 0.13.1 * gradle-buildconfig-plugin 3.1.0 -> 4.0.2 Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.21, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.21. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
* Kotlin 1.8.10 -> 1.8.21 * Ktor 2.2.4 -> 2.3.0 * kotlinx.coroutines 1.6.4 -> 1.7.0-RC * kotlin-node 18.14.0-pre.502 -> 18.16.0-pre.543 * KSP 1.8.10-1.0.9 -> 1.8.21-1.0.11 * KotlinPoet 1.12.0 -> 1.13.1 * JUnit 5 5.9.2 -> 5.9.3 * MockK 1.13.4 -> 1.13.5 * AtomicFU 0.20.0 -> 0.20.2 * Binary compatibility validator 0.13.0 -> 0.13.1 * gradle-buildconfig-plugin 3.1.0 -> 4.0.2 Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.21, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.21. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
* Kotlin 1.8.10 -> 1.8.21 * Ktor 2.2.4 -> 2.3.0 * kotlinx.coroutines 1.6.4 -> 1.7.0-RC * kotlin-node 18.14.0-pre.502 -> 18.16.0-pre.543 * KSP 1.8.10-1.0.9 -> 1.8.21-1.0.11 * KotlinPoet 1.12.0 -> 1.13.1 * JUnit 5 5.9.2 -> 5.9.3 * MockK 1.13.4 -> 1.13.5 * AtomicFU 0.20.0 -> 0.20.2 * Binary compatibility validator 0.13.0 -> 0.13.1 * gradle-buildconfig-plugin 3.1.0 -> 4.0.2 Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.21, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.21. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
* Kotlin 1.8.10 -> 1.8.21 * Ktor 2.2.4 -> 2.3.0 * kotlinx.coroutines 1.6.4 -> 1.7.0-RC * kotlin-node 18.14.0-pre.502 -> 18.16.3-pre.546 * KSP 1.8.10-1.0.9 -> 1.8.21-1.0.11 * KotlinPoet 1.12.0 -> 1.13.1 * JUnit 5 5.9.2 -> 5.9.3 * MockK 1.13.4 -> 1.13.5 * AtomicFU 0.20.0 -> 0.20.2 * Binary compatibility validator 0.13.0 -> 0.13.1 * gradle-buildconfig-plugin 3.1.0 -> 4.0.4 Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.21, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.21. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
* Kotlin 1.8.10 -> 1.8.21 * Ktor 2.2.4 -> 2.3.0 * kotlinx.coroutines 1.6.4 -> 1.7.0 * kotlin-node 18.14.0-pre.502 -> 18.16.3-pre.546 * KSP 1.8.10-1.0.9 -> 1.8.21-1.0.11 * KotlinPoet 1.12.0 -> 1.13.2 * JUnit 5 5.9.2 -> 5.9.3 * MockK 1.13.4 -> 1.13.5 * AtomicFU 0.20.0 -> 0.20.2 * Binary compatibility validator 0.13.0 -> 0.13.1 * gradle-buildconfig-plugin 3.1.0 -> 4.0.4 Warnings about duplicate library name with AtomicFU are no longer present with kotlinx.coroutines 1.7.0 and AtomicFU 0.20.2, so -Werror can be turned on again. Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.21, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.21. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
* Kotlin 1.8.10 -> 1.8.21 * Ktor 2.2.4 -> 2.3.0 * kotlinx.coroutines 1.6.4 -> 1.7.1 * kotlinx.serialization 1.5.0 -> 1.5.1 * kotlin-node 18.14.0-pre.502 -> 18.16.3-pre.546 * KSP 1.8.10-1.0.9 -> 1.8.21-1.0.11 * KotlinPoet 1.12.0 -> 1.13.2 * JUnit 5 5.9.2 -> 5.9.3 * MockK 1.13.4 -> 1.13.5 * AtomicFU 0.20.0 -> 0.20.2 * Binary compatibility validator 0.13.0 -> 0.13.1 * gradle-buildconfig-plugin 3.1.0 -> 4.0.4 Warnings about duplicate library name with AtomicFU are no longer present with kotlinx.coroutines 1.7.0 and AtomicFU 0.20.2, so -Werror can be turned on again. Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.21, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.21. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
* Kotlin 1.8.10 -> 1.8.21 * Ktor 2.2.4 -> 2.3.0 * kotlinx.coroutines 1.6.4 -> 1.7.1 * kotlinx.serialization 1.5.0 -> 1.5.1 * kotlin-node 18.14.0-pre.502 -> 18.16.3-pre.546 * KSP 1.8.10-1.0.9 -> 1.8.21-1.0.11 * KotlinPoet 1.12.0 -> 1.13.2 * JUnit 5 5.9.2 -> 5.9.3 * MockK 1.13.4 -> 1.13.5 * AtomicFU 0.20.0 -> 0.20.2 * Binary compatibility validator 0.13.0 -> 0.13.1 * gradle-buildconfig-plugin 3.1.0 -> 4.0.4 Warnings about duplicate library name with AtomicFU are no longer present with kotlinx.coroutines 1.7.1 and AtomicFU 0.20.2, so -Werror can be turned on again. Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.21, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.21. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
* Kotlin 1.8.10 -> 1.8.21 * Ktor 2.2.4 -> 2.3.0 * kotlinx.coroutines 1.6.4 -> 1.7.1 * kotlinx.serialization 1.5.0 -> 1.5.1 * kotlin-node 18.14.0-pre.502 -> 18.16.3-pre.546 * KSP 1.8.10-1.0.9 -> 1.8.21-1.0.11 * KotlinPoet 1.12.0 -> 1.13.2 * JUnit 5 5.9.2 -> 5.9.3 * MockK 1.13.4 -> 1.13.5 * AtomicFU 0.20.0 -> 0.20.2 * Binary compatibility validator 0.13.0 -> 0.13.1 * gradle-buildconfig-plugin 3.1.0 -> 4.0.4 Warnings about duplicate library name with AtomicFU are no longer present with kotlinx.coroutines 1.7.1 and AtomicFU 0.20.2, so -Werror can be turned on again. Using typealiases for overriding the default Instant serializer wasn't possible in #605 because of Kotlin/kotlinx.serialization#1895. Since this Bug was fixed in Kotlin 1.8.21, the typealiases dev.kord.common.serialization.InstantInEpochMilliseconds and dev.kord.common.serialization.InstantInEpochSeconds can now be used. The changes in the public API are probably because of changes in the serialization and AtomicFU plugins with Kotlin 1.8.21. However, they are unlikely to affect anyone since only generated symbols that aren't supposed to be accessed directly were touched.
Describe the bug
The default serializer of a serializable class can be overwritten by annotating the property that should be serialized with
SomeOtherSerializer
with@Serializable(with = SomeOtherSerializer::class)
.Since the
Serializable
annotation has the targetsPROPERTY
,CLASS
andTYPE
, I expected that this should also work when annotating the type of the property instead of the property itself.However it seems like this is only true for classes that are not serializable by default and always require specifying a serializer.
The reason I want to annotate the type instead of the property is for using typealiases with it. The project that I want to use this for needs to serialize
Instant
s in different formats and to reduce repetition and improve readability I wanted to replacewith
To Reproduce
The issue can be reproduced by the following code (requiring kotlinx-datetime as a dependency for the
Instant
class)custom serializers
Expected behavior
Instead of printing
it should print
(it should use
InstantInEpochSecondsSerializer
instead ofInstantIso8601Serializer
for theInstantType.instant
property)Environment
The text was updated successfully, but these errors were encountered: