Skip to content

Commit

Permalink
Update Kotlin to 1.8.20-Beta
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lukellmann committed Feb 10, 2023
1 parent ca0462d commit afa26ff
Show file tree
Hide file tree
Showing 14 changed files with 311 additions and 332 deletions.
218 changes: 109 additions & 109 deletions common/api/common.api

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions common/src/main/kotlin/entity/Data.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package dev.kord.common.entity

import dev.kord.common.entity.optional.Optional
import dev.kord.common.entity.optional.OptionalSnowflake
import dev.kord.common.serialization.InstantInEpochSecondsSerializer
import dev.kord.common.serialization.InstantInEpochSeconds
import kotlinx.datetime.Instant
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand All @@ -25,7 +25,6 @@ public data class DiscordTyping(
val guildId: OptionalSnowflake = OptionalSnowflake.Missing,
@SerialName("user_id")
val userId: Snowflake,
@Serializable(with = InstantInEpochSecondsSerializer::class)
val timestamp: Instant,
val timestamp: InstantInEpochSeconds,
val member: Optional<DiscordGuildMember> = Optional.Missing()
)
10 changes: 4 additions & 6 deletions common/src/main/kotlin/entity/DiscordActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ package dev.kord.common.entity
import dev.kord.common.entity.optional.Optional
import dev.kord.common.entity.optional.OptionalBoolean
import dev.kord.common.entity.optional.OptionalSnowflake
import dev.kord.common.serialization.InstantInEpochMillisecondsSerializer
import kotlinx.datetime.Instant
import dev.kord.common.serialization.InstantInEpochMilliseconds
import kotlinx.serialization.*
import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.builtins.serializer
Expand All @@ -28,8 +27,7 @@ public data class DiscordActivity(
val type: ActivityType,
val url: Optional<String?> = Optional.Missing(),
@SerialName("created_at")
@Serializable(with = InstantInEpochMillisecondsSerializer::class)
val createdAt: Instant,
val createdAt: InstantInEpochMilliseconds,
val timestamps: Optional<DiscordActivityTimestamps> = Optional.Missing(),
@SerialName("application_id")
val applicationId: OptionalSnowflake = OptionalSnowflake.Missing,
Expand Down Expand Up @@ -75,8 +73,8 @@ public class ActivityFlags(public val value: Int) {

@Serializable
public data class DiscordActivityTimestamps(
val start: Optional<@Serializable(with = InstantInEpochMillisecondsSerializer::class) Instant> = Optional.Missing(),
val end: Optional<@Serializable(with = InstantInEpochMillisecondsSerializer::class) Instant> = Optional.Missing(),
val start: Optional<InstantInEpochMilliseconds> = Optional.Missing(),
val end: Optional<InstantInEpochMilliseconds> = Optional.Missing(),
)

@Serializable
Expand Down
14 changes: 4 additions & 10 deletions common/src/main/kotlin/serialization/InstantSerializers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,8 @@ public object InstantInEpochMillisecondsSerializer : KSerializer<Instant> {
}
}

// TODO use this typealias instead of annotating types/properties with
// @Serializable(with = InstantInEpochMillisecondsSerializer::class) once
// https://github.com/Kotlin/kotlinx.serialization/issues/1895 is fixed
// /** An [Instant] that is [serializable][Serializable] with [InstantInEpochMillisecondsSerializer]. */
// public typealias InstantInEpochMilliseconds = @Serializable(with = InstantInEpochMillisecondsSerializer::class) Instant
/** An [Instant] that is [serializable][Serializable] with [InstantInEpochMillisecondsSerializer]. */
public typealias InstantInEpochMilliseconds = @Serializable(with = InstantInEpochMillisecondsSerializer::class) Instant


// epoch seconds
Expand All @@ -62,8 +59,5 @@ public object InstantInEpochSecondsSerializer : KSerializer<Instant> {
}
}

// TODO use this typealias instead of annotating types/properties with
// @Serializable(with = InstantInEpochSecondsSerializer::class) once
// https://github.com/Kotlin/kotlinx.serialization/issues/1895 is fixed
// /** An [Instant] that is [serializable][Serializable] with [InstantInEpochSecondsSerializer]. */
// public typealias InstantInEpochSeconds = @Serializable(with = InstantInEpochSecondsSerializer::class) Instant
/** An [Instant] that is [serializable][Serializable] with [InstantInEpochSecondsSerializer]. */
public typealias InstantInEpochSeconds = @Serializable(with = InstantInEpochSecondsSerializer::class) Instant
148 changes: 74 additions & 74 deletions core/api/core.api

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions core/src/main/kotlin/cache/data/ActivityData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ import dev.kord.common.entity.*
import dev.kord.common.entity.optional.Optional
import dev.kord.common.entity.optional.OptionalBoolean
import dev.kord.common.entity.optional.OptionalSnowflake
import dev.kord.common.serialization.InstantInEpochMillisecondsSerializer
import kotlinx.datetime.Instant
import dev.kord.common.serialization.InstantInEpochMilliseconds
import kotlinx.serialization.Serializable

@Serializable
public data class ActivityData(
val name: String,
val type: ActivityType,
val url: Optional<String?> = Optional.Missing(),
@Serializable(with = InstantInEpochMillisecondsSerializer::class)
val createdAt: Instant,
val createdAt: InstantInEpochMilliseconds,
val timestamps: Optional<DiscordActivityTimestamps> = Optional.Missing(),
val applicationId: OptionalSnowflake = OptionalSnowflake.Missing,
val details: Optional<String?> = Optional.Missing(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ import dev.kord.common.entity.DiscordTyping
import dev.kord.common.entity.Snowflake
import dev.kord.common.entity.optional.Optional
import dev.kord.common.entity.optional.OptionalSnowflake
import dev.kord.common.serialization.InstantInEpochSecondsSerializer
import kotlinx.datetime.Instant
import dev.kord.common.serialization.InstantInEpochSeconds
import kotlinx.serialization.Serializable

@Serializable
public data class TypingStartEventData(
val channelId: Snowflake,
val guildId: OptionalSnowflake = OptionalSnowflake.Missing,
val userId: Snowflake,
@Serializable(with = InstantInEpochSecondsSerializer::class)
val timestamp: Instant,
val timestamp: InstantInEpochSeconds,
val member: Optional<DiscordGuildMember> = Optional.Missing()
) {
public companion object {
Expand Down
43 changes: 19 additions & 24 deletions gateway/api/gateway.api
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public final class dev/kord/gateway/DiscordAutoModerationActionExecution {
public final fun getUserId ()Ldev/kord/common/entity/Snowflake;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun write$Self (Ldev/kord/gateway/DiscordAutoModerationActionExecution;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public static final synthetic fun write$Self (Ldev/kord/gateway/DiscordAutoModerationActionExecution;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}

public final class dev/kord/gateway/DiscordAutoModerationActionExecution$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
Expand Down Expand Up @@ -372,7 +372,7 @@ public final class dev/kord/gateway/DiscordCreatedInvite {
public final fun getUses ()I
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun write$Self (Ldev/kord/gateway/DiscordCreatedInvite;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public static final synthetic fun write$Self (Ldev/kord/gateway/DiscordCreatedInvite;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}

public final class dev/kord/gateway/DiscordCreatedInvite$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
Expand Down Expand Up @@ -406,7 +406,7 @@ public final class dev/kord/gateway/DiscordDeletedInvite {
public final fun getGuildId ()Ldev/kord/common/entity/optional/OptionalSnowflake;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun write$Self (Ldev/kord/gateway/DiscordDeletedInvite;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public static final synthetic fun write$Self (Ldev/kord/gateway/DiscordDeletedInvite;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}

public final class dev/kord/gateway/DiscordDeletedInvite$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
Expand Down Expand Up @@ -442,7 +442,7 @@ public final class dev/kord/gateway/DiscordPresence {
public final fun getStatus ()Ldev/kord/common/entity/PresenceStatus;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun write$Self (Ldev/kord/gateway/DiscordPresence;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public static final synthetic fun write$Self (Ldev/kord/gateway/DiscordPresence;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}

public final class dev/kord/gateway/DiscordPresence$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
Expand Down Expand Up @@ -477,7 +477,7 @@ public final class dev/kord/gateway/DiscordRemovedEmoji {
public final fun getMessageId ()Ldev/kord/common/entity/Snowflake;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun write$Self (Ldev/kord/gateway/DiscordRemovedEmoji;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public static final synthetic fun write$Self (Ldev/kord/gateway/DiscordRemovedEmoji;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}

public final class dev/kord/gateway/DiscordRemovedEmoji$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
Expand Down Expand Up @@ -508,7 +508,7 @@ public final class dev/kord/gateway/DiscordRemovedReactionEmoji {
public final fun getName ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun write$Self (Ldev/kord/gateway/DiscordRemovedReactionEmoji;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public static final synthetic fun write$Self (Ldev/kord/gateway/DiscordRemovedReactionEmoji;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}

public final class dev/kord/gateway/DiscordRemovedReactionEmoji$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
Expand Down Expand Up @@ -544,7 +544,7 @@ public final class dev/kord/gateway/DiscordThreadListSync {
public final fun getThreads ()Ljava/util/List;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun write$Self (Ldev/kord/gateway/DiscordThreadListSync;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public static final synthetic fun write$Self (Ldev/kord/gateway/DiscordThreadListSync;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}

public final class dev/kord/gateway/DiscordThreadListSync$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
Expand Down Expand Up @@ -582,7 +582,7 @@ public final class dev/kord/gateway/DiscordThreadMembersUpdate {
public final fun getRemovedMemberIds ()Ldev/kord/common/entity/optional/Optional;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun write$Self (Ldev/kord/gateway/DiscordThreadMembersUpdate;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public static final synthetic fun write$Self (Ldev/kord/gateway/DiscordThreadMembersUpdate;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}

public final class dev/kord/gateway/DiscordThreadMembersUpdate$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
Expand Down Expand Up @@ -852,7 +852,7 @@ public final class dev/kord/gateway/GuildMembersChunkData {
public final fun getPresences ()Ldev/kord/common/entity/optional/Optional;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun write$Self (Ldev/kord/gateway/GuildMembersChunkData;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public static final synthetic fun write$Self (Ldev/kord/gateway/GuildMembersChunkData;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}

public final class dev/kord/gateway/GuildMembersChunkData$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
Expand Down Expand Up @@ -976,7 +976,7 @@ public final class dev/kord/gateway/GuildScheduledEventUserMetadata {
public final fun getUserId ()Ldev/kord/common/entity/Snowflake;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun write$Self (Ldev/kord/gateway/GuildScheduledEventUserMetadata;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public static final synthetic fun write$Self (Ldev/kord/gateway/GuildScheduledEventUserMetadata;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}

public final class dev/kord/gateway/GuildScheduledEventUserMetadata$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
Expand Down Expand Up @@ -1056,7 +1056,7 @@ public final class dev/kord/gateway/Hello : dev/kord/gateway/Event {
public final fun getHeartbeatInterval ()I
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun write$Self (Ldev/kord/gateway/Hello;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public static final synthetic fun write$Self (Ldev/kord/gateway/Hello;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}

public final class dev/kord/gateway/Hello$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
Expand Down Expand Up @@ -1098,7 +1098,7 @@ public final class dev/kord/gateway/Identify : dev/kord/gateway/Command {
public final fun getToken ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun write$Self (Ldev/kord/gateway/Identify;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public static final synthetic fun write$Self (Ldev/kord/gateway/Identify;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}

public final class dev/kord/gateway/Identify$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
Expand Down Expand Up @@ -1131,7 +1131,7 @@ public final class dev/kord/gateway/IdentifyProperties {
public final fun getOs ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun write$Self (Ldev/kord/gateway/IdentifyProperties;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public static final synthetic fun write$Self (Ldev/kord/gateway/IdentifyProperties;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}

public final class dev/kord/gateway/IdentifyProperties$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
Expand Down Expand Up @@ -1541,7 +1541,7 @@ public final class dev/kord/gateway/ReadyData {
public final fun getVersion ()I
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun write$Self (Ldev/kord/gateway/ReadyData;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public static final synthetic fun write$Self (Ldev/kord/gateway/ReadyData;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}

public final class dev/kord/gateway/ReadyData$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
Expand Down Expand Up @@ -1585,7 +1585,7 @@ public final class dev/kord/gateway/RequestGuildMembers : dev/kord/gateway/Comma
public final fun getUserIds ()Ldev/kord/common/entity/optional/Optional;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun write$Self (Ldev/kord/gateway/RequestGuildMembers;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public static final synthetic fun write$Self (Ldev/kord/gateway/RequestGuildMembers;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}

public final class dev/kord/gateway/RequestGuildMembers$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
Expand All @@ -1605,14 +1605,9 @@ public final class dev/kord/gateway/RequestGuildMembers$Companion {

public final class dev/kord/gateway/RequestGuildMembers$Nonce {
public static final field INSTANCE Ldev/kord/gateway/RequestGuildMembers$Nonce;
public static final field counter$dev$VolatileWrapper Ldev/kord/gateway/RequestGuildMembers$Nonce$Counter$dev$VolatileWrapper;
public final fun new ()Ljava/lang/String;
}

public final class dev/kord/gateway/RequestGuildMembers$Nonce$Counter$dev$VolatileWrapper {
public fun <init> ()V
}

public final class dev/kord/gateway/Resume : dev/kord/gateway/Command {
public static final field Companion Ldev/kord/gateway/Resume$Companion;
public synthetic fun <init> (ILjava/lang/String;Ljava/lang/String;ILkotlinx/serialization/internal/SerializationConstructorMarker;)V
Expand All @@ -1628,7 +1623,7 @@ public final class dev/kord/gateway/Resume : dev/kord/gateway/Command {
public final fun getToken ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun write$Self (Ldev/kord/gateway/Resume;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public static final synthetic fun write$Self (Ldev/kord/gateway/Resume;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}

public final class dev/kord/gateway/Resume$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
Expand Down Expand Up @@ -1657,7 +1652,7 @@ public final class dev/kord/gateway/Resumed : dev/kord/gateway/DispatchEvent {
public fun getSequence ()Ljava/lang/Integer;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun write$Self (Ldev/kord/gateway/Resumed;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public static final synthetic fun write$Self (Ldev/kord/gateway/Resumed;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}

public final class dev/kord/gateway/Resumed$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
Expand Down Expand Up @@ -1792,7 +1787,7 @@ public final class dev/kord/gateway/UpdateStatus : dev/kord/gateway/Command {
public final fun getStatus ()Ldev/kord/common/entity/PresenceStatus;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun write$Self (Ldev/kord/gateway/UpdateStatus;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public static final synthetic fun write$Self (Ldev/kord/gateway/UpdateStatus;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}

public final class dev/kord/gateway/UpdateStatus$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
Expand Down Expand Up @@ -1827,7 +1822,7 @@ public final class dev/kord/gateway/UpdateVoiceStatus : dev/kord/gateway/Command
public final fun getSelfMute ()Z
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public static final fun write$Self (Ldev/kord/gateway/UpdateVoiceStatus;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
public static final synthetic fun write$Self (Ldev/kord/gateway/UpdateVoiceStatus;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}

public final class dev/kord/gateway/UpdateVoiceStatus$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
Expand Down
Loading

0 comments on commit afa26ff

Please sign in to comment.