diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt index 873bf478c..633f6ce7a 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt @@ -60,15 +60,18 @@ interface MessageChain : Message, Iterable { * @param key 由各个类型消息的伴生对象持有. 如 [PlainText.Key] * @throws NoSuchElementException 当找不到这个类型的 [Message] 时 */ + @Suppress("INAPPLICABLE_JVM_NAME") @JvmName("first") - operator fun get(key: Message.Key): M = first(key) + /* final */ operator fun get(key: Message.Key): M = first(key) /** * 获取第一个类型为 [key] 的 [Message] 实例, 找不到则返回 `null` * * @param key 由各个类型消息的伴生对象持有. 如 [PlainText.Key] */ - fun getOrNull(key: Message.Key): M? = firstOrNull(key) + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("firstOrNull") + /* final */ fun getOrNull(key: Message.Key): M? = firstOrNull(key) /** * 遍历每一个有内容的消息, 即 [At], [AtAll], [PlainText], [Image], [Face], [XmlMessage], [QuoteReply]. @@ -94,11 +97,19 @@ interface MessageChain : Message, Iterable { this.forEach(block) } + @PlannedRemoval("1.0.0") @Deprecated("for binary compatibility", level = DeprecationLevel.HIDDEN) @JvmSynthetic @Suppress("FunctionName", "INAPPLICABLE_JVM_NAME") @JvmName("get") fun get2(key: Message.Key): M = first(key) + + @PlannedRemoval("1.0.0") + @Deprecated("for binary compatibility", level = DeprecationLevel.HIDDEN) + @JvmSynthetic + @Suppress("FunctionName", "INAPPLICABLE_JVM_NAME") + @JvmName("getOrNull") + fun getOrNull2(key: Message.Key): M? = getOrNull(key) } // region accessors