mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-22 13:46:13 +08:00
Deprecate EmptyMessageChain.serializer()
for stability concerns
This commit is contained in:
parent
4e021d3b3e
commit
25ddb41544
@ -341,7 +341,7 @@ public sealed interface MessageChain :
|
||||
/**
|
||||
* 不含任何元素的 [MessageChain].
|
||||
*/
|
||||
@Serializable(MessageChain.Serializer::class)
|
||||
//@Serializable(MessageChain.Serializer::class)
|
||||
public object EmptyMessageChain : MessageChain, List<SingleMessage> by emptyList() {
|
||||
override val size: Int get() = 0
|
||||
|
||||
@ -358,6 +358,14 @@ public object EmptyMessageChain : MessageChain, List<SingleMessage> by emptyList
|
||||
|
||||
override fun iterator(): Iterator<SingleMessage> = EmptyMessageChainIterator
|
||||
|
||||
@Suppress("DeprecatedCallableAddReplaceWith")
|
||||
@Deprecated(
|
||||
"Serializers for EmptyMessageChain is not provided any more. " +
|
||||
"Please specify your serial property as MessageChain and use contextual and polymorphic serializers from MessageSerializers.serializersModule.",
|
||||
level = DeprecationLevel.WARNING
|
||||
) // deprecated since 2.8-M1
|
||||
public fun serializer(): KSerializer<MessageChain> = MessageChain.Serializer
|
||||
|
||||
private object EmptyMessageChainIterator : Iterator<SingleMessage> {
|
||||
override fun hasNext(): Boolean = false
|
||||
override fun next(): Nothing = throw NoSuchElementException("EmptyMessageChain is empty.")
|
||||
|
Loading…
Reference in New Issue
Block a user