Add @NotStableForInheritance and apply it to suitable classes (#1385)

* Add `@NotStableForInheritance` and apply it to suitable classes

* apiDump

* Fix import

* fix
This commit is contained in:
Him188 2021-07-05 12:50:00 +08:00 committed by GitHub
parent 7722a5a0b0
commit abc2bfcb3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 178 additions and 93 deletions

View File

@ -5624,6 +5624,10 @@ public final class net/mamoe/mirai/utils/MiraiLoggerWithSwitch : net/mamoe/mirai
public fun warning0 (Ljava/lang/String;Ljava/lang/Throwable;)V
}
public abstract interface annotation class net/mamoe/mirai/utils/NotStableForInheritance : java/lang/annotation/Annotation {
public abstract fun message ()Ljava/lang/String;
}
public final class net/mamoe/mirai/utils/OverFileSizeMaxException : java/lang/IllegalStateException {
public fun <init> ()V
}

View File

@ -5624,6 +5624,10 @@ public final class net/mamoe/mirai/utils/MiraiLoggerWithSwitch : net/mamoe/mirai
public fun warning0 (Ljava/lang/String;Ljava/lang/Throwable;)V
}
public abstract interface annotation class net/mamoe/mirai/utils/NotStableForInheritance : java/lang/annotation/Annotation {
public abstract fun message ()Ljava/lang/String;
}
public final class net/mamoe/mirai/utils/OverFileSizeMaxException : java/lang/IllegalStateException {
public fun <init> ()V
}

View File

@ -1,10 +1,10 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
@file:Suppress("NOTHING_TO_INLINE")
@ -22,6 +22,7 @@ import net.mamoe.mirai.message.action.MemberNudge
import net.mamoe.mirai.network.LoginFailedException
import net.mamoe.mirai.utils.BotConfiguration
import net.mamoe.mirai.utils.MiraiLogger
import net.mamoe.mirai.utils.NotStableForInheritance
import java.util.concurrent.ConcurrentHashMap
/**
@ -41,6 +42,7 @@ public suspend inline fun <B : Bot> B.alsoLogin(): B = also { login() }
*
* @see BotFactory 构造 [Bot] 的工厂, [Bot] 唯一的构造方式.
*/
@NotStableForInheritance
public interface Bot : CoroutineScope, ContactOrBot, UserOrBot {
/**
* Bot 配置

View File

@ -1,10 +1,10 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
@file:Suppress("INTERFACE_NOT_SUPPORTED", "PropertyName")
@ -33,6 +33,7 @@ import net.mamoe.mirai.message.data.MessageSource.Key.recall
import net.mamoe.mirai.utils.FileCacheStrategy
import net.mamoe.mirai.utils.MiraiExperimentalApi
import net.mamoe.mirai.utils.MiraiInternalApi
import net.mamoe.mirai.utils.NotStableForInheritance
/**
* [IMirai] 实例.
@ -75,6 +76,7 @@ public val Mirai: IMirai
*
* @see Mirai 获取实例
*/
@NotStableForInheritance
public interface IMirai : LowLevelApiAccessor {
/**
* 请优先使用 [BotFactory.INSTANCE]

View File

@ -16,10 +16,7 @@ import net.mamoe.kjbb.JvmBlockingBridge
import net.mamoe.mirai.contact.*
import net.mamoe.mirai.data.*
import net.mamoe.mirai.message.data.Voice
import net.mamoe.mirai.utils.ExternalResource
import net.mamoe.mirai.utils.MiraiExperimentalApi
import net.mamoe.mirai.utils.MiraiInternalApi
import net.mamoe.mirai.utils.WeakRef
import net.mamoe.mirai.utils.*
import kotlin.annotation.AnnotationTarget.*
/**
@ -41,6 +38,7 @@ public annotation class LowLevelApi
* **警告**: 所有的低级 API 都可能在任意时刻不经过任何警告和迭代就被修改. 因此非常不建议在任何情况下使用这些 API.
*/
@LowLevelApi
@NotStableForInheritance
public interface LowLevelApiAccessor {
/**
* 主动刷新 keys, SKey, PSKey .

View File

@ -7,19 +7,22 @@
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
@file:Suppress("DeprecatedCallableAddReplaceWith")
package net.mamoe.mirai.contact
import net.mamoe.mirai.message.action.MemberNudge
import net.mamoe.mirai.message.data.Image
import net.mamoe.mirai.message.data.Message
import net.mamoe.mirai.utils.ExternalResource
import net.mamoe.mirai.utils.NotStableForInheritance
/**
* 匿名
*
* 代表匿名群成员
*/
@Suppress("DeprecatedCallableAddReplaceWith")
@NotStableForInheritance
public interface AnonymousMember : Member {
/** 该匿名群成员 ID */
public val anonymousId: String

View File

@ -1,23 +1,27 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
@file:Suppress("EXPERIMENTAL_API_USAGE", "NOTHING_TO_INLINE", "EXPERIMENTAL_OVERRIDE")
@file:OptIn(JavaFriendlyAPI::class)
@file:JvmBlockingBridge
package net.mamoe.mirai.contact
import kotlinx.coroutines.CoroutineScope
import net.mamoe.kjbb.JvmBlockingBridge
import net.mamoe.mirai.*
import net.mamoe.mirai.Bot
import net.mamoe.mirai.IMirai
import net.mamoe.mirai.Mirai
import net.mamoe.mirai.event.events.*
import net.mamoe.mirai.message.MessageReceipt
import net.mamoe.mirai.message.data.*
import net.mamoe.mirai.recallMessage
import net.mamoe.mirai.utils.*
import net.mamoe.mirai.utils.ExternalResource.Companion.sendAsImageTo
import net.mamoe.mirai.utils.ExternalResource.Companion.uploadAsImage
@ -27,7 +31,7 @@ import java.io.InputStream
/**
* 联系对象, 即可以与 [Bot] 互动的对象. 包含 [用户][User], [][Group].
*/
@JvmBlockingBridge
@NotStableForInheritance
public interface Contact : ContactOrBot, CoroutineScope {
/**
* 这个联系对象所属 [Bot].

View File

@ -1,16 +1,17 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
package net.mamoe.mirai.contact
import kotlinx.coroutines.CoroutineScope
import net.mamoe.mirai.Bot
import net.mamoe.mirai.utils.NotStableForInheritance
/**
* 拥有 [id] 的对象.
@ -21,6 +22,7 @@ import net.mamoe.mirai.Bot
* @see Contact
* @see Bot
*/
@NotStableForInheritance
public interface ContactOrBot : CoroutineScope {
/**
* QQ 号或群号.

View File

@ -1,15 +1,16 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
package net.mamoe.mirai.contact
import net.mamoe.mirai.utils.NotStableForInheritance
import net.mamoe.mirai.utils.RemoteFile
/**
@ -19,6 +20,7 @@ import net.mamoe.mirai.utils.RemoteFile
*
* @since 2.5
*/
@NotStableForInheritance
public interface FileSupported : Contact {
/**
* 文件根目录. 可通过 [RemoteFile.listFiles] 获取目录下文件列表.

View File

@ -8,6 +8,7 @@
*/
@file:Suppress("EXPERIMENTAL_API_USAGE", "unused", "UnusedImport")
@file:JvmBlockingBridge
package net.mamoe.mirai.contact
@ -21,6 +22,7 @@ import net.mamoe.mirai.message.action.Nudge
import net.mamoe.mirai.message.data.Message
import net.mamoe.mirai.message.data.isContentEmpty
import net.mamoe.mirai.message.data.toPlainText
import net.mamoe.mirai.utils.NotStableForInheritance
/**
* 代表一位好友.
@ -31,7 +33,7 @@ import net.mamoe.mirai.message.data.toPlainText
*
* @see FriendMessageEvent
*/
@JvmBlockingBridge
@NotStableForInheritance
public interface Friend : User, CoroutineScope, VoiceSupported {
/**
* QQ 号码

View File

@ -1,13 +1,14 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
@file:Suppress("EXPERIMENTAL_API_USAGE", "unused", "UnusedImport", "NOTHING_TO_INLINE")
@file:JvmBlockingBridge
package net.mamoe.mirai.contact
@ -23,15 +24,13 @@ import net.mamoe.mirai.data.covertToGroupAnnouncement
import net.mamoe.mirai.event.events.*
import net.mamoe.mirai.message.MessageReceipt
import net.mamoe.mirai.message.data.*
import net.mamoe.mirai.utils.ExternalResource
import net.mamoe.mirai.utils.ExternalResource.Companion.uploadAsVoice
import net.mamoe.mirai.utils.MiraiExperimentalApi
import net.mamoe.mirai.utils.OverFileSizeMaxException
import net.mamoe.mirai.utils.NotStableForInheritance
/**
* .
*/
@JvmBlockingBridge
@NotStableForInheritance
public interface Group : Contact, CoroutineScope, FileSupported, VoiceSupported {
/**
* 群名称.

View File

@ -1,13 +1,14 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
@file:Suppress("unused", "UnusedImport")
@file:JvmBlockingBridge
package net.mamoe.mirai.contact
@ -19,6 +20,7 @@ import net.mamoe.mirai.message.action.MemberNudge
import net.mamoe.mirai.message.action.Nudge
import net.mamoe.mirai.message.data.Message
import net.mamoe.mirai.message.data.isContentEmpty
import net.mamoe.mirai.utils.NotStableForInheritance
import net.mamoe.mirai.utils.WeakRefProperty
/**
@ -34,7 +36,7 @@ import net.mamoe.mirai.utils.WeakRefProperty
* - [Member.asFriend] 转换为 [Friend]
* - [Member.asStranger] 转换为 [Stranger]
*/
@JvmBlockingBridge
@NotStableForInheritance
public interface Member : User {
/**
* 所在的群.

View File

@ -1,12 +1,14 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
@file:JvmBlockingBridge
package net.mamoe.mirai.contact
import net.mamoe.kjbb.JvmBlockingBridge
@ -18,6 +20,7 @@ import net.mamoe.mirai.message.action.Nudge
import net.mamoe.mirai.message.data.Message
import net.mamoe.mirai.message.data.isContentEmpty
import net.mamoe.mirai.message.data.toPlainText
import net.mamoe.mirai.utils.NotStableForInheritance
import kotlin.time.Duration
import kotlin.time.DurationUnit
import kotlin.time.ExperimentalTime
@ -28,7 +31,7 @@ import kotlin.time.ExperimentalTime
* 群成员可能也是好友, 但他们在对象类型上不同.
* 群成员可以通过 [asFriend] 得到相关好友对象.
*/
@JvmBlockingBridge
@NotStableForInheritance
public interface NormalMember : Member {
/**
* 群名片. 可能为空.

View File

@ -1,10 +1,10 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
@file:Suppress("unused")
@ -20,11 +20,13 @@ import net.mamoe.mirai.utils.BotConfiguration.MiraiProtocol.ANDROID_PAD
import net.mamoe.mirai.utils.BotConfiguration.MiraiProtocol.ANDROID_PHONE
import net.mamoe.mirai.utils.ExternalResource
import net.mamoe.mirai.utils.MiraiInternalApi
import net.mamoe.mirai.utils.NotStableForInheritance
import net.mamoe.mirai.utils.toLongUnsigned
/**
* 其他设备. 如当 [Bot] [ANDROID_PHONE] 登录时, 还可以有其他设备以 [ANDROID_PAD], iOS, PC 或其他设备登录.
*/
@NotStableForInheritance
public interface OtherClient : Contact {
public val info: OtherClientInfo

View File

@ -1,13 +1,14 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
@file:Suppress("EXPERIMENTAL_API_USAGE", "unused", "UnusedImport")
@file:JvmBlockingBridge
package net.mamoe.mirai.contact
@ -21,6 +22,7 @@ import net.mamoe.mirai.message.action.StrangerNudge
import net.mamoe.mirai.message.data.Message
import net.mamoe.mirai.message.data.isContentEmpty
import net.mamoe.mirai.message.data.toPlainText
import net.mamoe.mirai.utils.NotStableForInheritance
/**
* 代表一位陌生人.
@ -39,7 +41,7 @@ import net.mamoe.mirai.message.data.toPlainText
*
* @see StrangerMessageEvent
*/
@JvmBlockingBridge
@NotStableForInheritance
public interface Stranger : User, CoroutineScope {
/**
* QQ 号码

View File

@ -10,6 +10,7 @@
package net.mamoe.mirai.contact
import net.mamoe.mirai.utils.MiraiInternalApi
import net.mamoe.mirai.utils.NotStableForInheritance
/**
* 临时会话用户, 非群成员.
@ -17,4 +18,5 @@ import net.mamoe.mirai.utils.MiraiInternalApi
* [#429](https://github.com/mamoe/mirai/issues/429)
*/
@MiraiInternalApi("其他渠道的临时会话暂未支持. ")
@NotStableForInheritance
public interface TempUser : User

View File

@ -1,13 +1,14 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
@file:Suppress("EXPERIMENTAL_API_USAGE", "unused")
@file:JvmBlockingBridge
package net.mamoe.mirai.contact
@ -25,6 +26,7 @@ import net.mamoe.mirai.message.action.UserNudge
import net.mamoe.mirai.message.data.Message
import net.mamoe.mirai.message.data.isContentEmpty
import net.mamoe.mirai.message.data.toPlainText
import net.mamoe.mirai.utils.NotStableForInheritance
/**
* 代表一个 **用户**.
@ -36,7 +38,7 @@ import net.mamoe.mirai.message.data.toPlainText
*
* 对于同一个 [Bot] 任何一个人的 [User] 实例都是单一的.
*/
@JvmBlockingBridge
@NotStableForInheritance
public interface User : Contact, UserOrBot, CoroutineScope {
/**
* QQ 号码

View File

@ -1,16 +1,17 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
package net.mamoe.mirai.contact
import net.mamoe.mirai.Bot
import net.mamoe.mirai.message.action.Nudge
import net.mamoe.mirai.utils.NotStableForInheritance
/**
* @see User
@ -18,6 +19,7 @@ import net.mamoe.mirai.message.action.Nudge
*
* @see ContactOrBot
*/
@NotStableForInheritance
public interface UserOrBot : ContactOrBot {
/**
* 昵称

View File

@ -1,10 +1,10 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
package net.mamoe.mirai.contact
@ -13,6 +13,7 @@ import net.mamoe.kjbb.JvmBlockingBridge
import net.mamoe.mirai.message.data.Voice
import net.mamoe.mirai.utils.ExternalResource
import net.mamoe.mirai.utils.ExternalResource.Companion.uploadAsVoice
import net.mamoe.mirai.utils.NotStableForInheritance
import net.mamoe.mirai.utils.OverFileSizeMaxException
/**
@ -20,6 +21,7 @@ import net.mamoe.mirai.utils.OverFileSizeMaxException
*
* @since 2.7
*/
@NotStableForInheritance
public interface VoiceSupported : Contact {
/**
* 上传一个语音消息以备发送.

View File

@ -1,10 +1,10 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
@file:Suppress("unused", "DEPRECATION", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
@ -16,6 +16,7 @@ package net.mamoe.mirai.event
import kotlinx.coroutines.CompletableJob
import kotlinx.coroutines.sync.Mutex
import net.mamoe.mirai.event.EventPriority.*
import net.mamoe.mirai.utils.NotStableForInheritance
/**
* 订阅者的状态
@ -43,6 +44,7 @@ public enum class ListeningStatus {
*
* 取消监听: [complete]
*/
@NotStableForInheritance
public interface Listener<in E : Event> : CompletableJob {
// Impl notes:

View File

@ -1,13 +1,14 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
@file:Suppress("NOTHING_TO_INLINE", "FunctionName", "unused")
@file:JvmBlockingBridge
package net.mamoe.mirai.message
@ -21,6 +22,7 @@ import net.mamoe.mirai.message.data.*
import net.mamoe.mirai.message.data.MessageSource.Key.quote
import net.mamoe.mirai.message.data.MessageSource.Key.recallIn
import net.mamoe.mirai.utils.MiraiInternalApi
import net.mamoe.mirai.utils.NotStableForInheritance
/**
* 发送消息后得到的回执. 可用于撤回, 引用回复等.
@ -39,7 +41,7 @@ import net.mamoe.mirai.utils.MiraiInternalApi
* @see MessageReceipt.sourceIds ids
* @see MessageReceipt.sourceTime 源时间
*/
@JvmBlockingBridge
@NotStableForInheritance
public open class MessageReceipt<out C : Contact>
@MiraiInternalApi
@Deprecated("Do not call it directly", level = DeprecationLevel.ERROR)

View File

@ -1,10 +1,10 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
package net.mamoe.mirai.message
@ -22,6 +22,7 @@ import net.mamoe.mirai.message.data.MessageChain
import net.mamoe.mirai.message.data.MessageChain.Companion.serializeToJsonString
import net.mamoe.mirai.message.data.SingleMessage
import net.mamoe.mirai.utils.MiraiExperimentalApi
import net.mamoe.mirai.utils.NotStableForInheritance
import kotlin.reflect.KClass
/**
@ -38,6 +39,7 @@ import kotlin.reflect.KClass
*
* @see MessageSerializers.INSTANCE
*/
@NotStableForInheritance
public interface MessageSerializers {
/**
* 包含 [SingleMessage] 多态序列化和 [Message] [ContextualSerializer] 信息的 [SerializersModule].

View File

@ -1,10 +1,10 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
package net.mamoe.mirai.message.code
@ -12,6 +12,7 @@ package net.mamoe.mirai.message.code
import net.mamoe.mirai.message.code.MiraiCode.deserializeMiraiCode
import net.mamoe.mirai.message.data.Message
import net.mamoe.mirai.utils.MiraiExperimentalApi
import net.mamoe.mirai.utils.NotStableForInheritance
/**
@ -19,8 +20,12 @@ import net.mamoe.mirai.utils.MiraiExperimentalApi
*
* 从字符串解析 mirai [MiraiCode.deserializeMiraiCode]
*
* ### 不适合第三方实现
* 即使自定义消息类型实现了接口 [CodableMessage], [MiraiCode.deserializeMiraiCode] 时也无法解析消息类型. 因此实现没有意义.
*
* @see MiraiCode
*/
@NotStableForInheritance
public interface CodableMessage : Message {
/**
* 转换为 mirai .

View File

@ -39,6 +39,7 @@ import net.mamoe.mirai.utils.*
*/
@Serializable(FileMessage.Serializer::class)
@SerialName(FileMessage.SERIAL_NAME)
@NotStableForInheritance
public interface FileMessage : MessageContent, ConstrainSingle, CodableMessage {
/**
* 服务器需要的某种 ID.

View File

@ -1,10 +1,10 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
@file:Suppress("unused", "NOTHING_TO_INLINE")
@ -14,6 +14,7 @@
package net.mamoe.mirai.message.data
import net.mamoe.mirai.utils.MiraiExperimentalApi
import net.mamoe.mirai.utils.NotStableForInheritance
import net.mamoe.mirai.utils.castOrNull
/**
@ -27,6 +28,7 @@ import net.mamoe.mirai.utils.castOrNull
* @see VipFace VIP 表情
*/
@MiraiExperimentalApi
@NotStableForInheritance
public interface HummerMessage : MessageContent, ConstrainSingle {
public companion object Key :
AbstractPolymorphicMessageKey<MessageContent, HummerMessage>(MessageContent, { it.castOrNull() })

View File

@ -70,6 +70,7 @@ import kotlin.LazyThreadSafetyMode.NONE
* @see Image.flash 转换普通图片为闪照
*/
@Serializable(Image.Serializer::class)
@NotStableForInheritance
public interface Image : Message, MessageContent, CodableMessage {
/**

View File

@ -1,15 +1,16 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
package net.mamoe.mirai.message.data
import net.mamoe.mirai.utils.MiraiExperimentalApi
import net.mamoe.mirai.utils.NotStableForInheritance
import net.mamoe.mirai.utils.safeCast
/**
@ -19,6 +20,7 @@ import net.mamoe.mirai.utils.safeCast
*
* @see Dice
*/
@NotStableForInheritance
public interface MarketFace : HummerMessage {
/**
* `[开心]`

View File

@ -1,10 +1,10 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
@file:JvmMultifileClass
@ -33,6 +33,7 @@ import net.mamoe.mirai.message.data.MessageSource.Key.quote
import net.mamoe.mirai.message.data.MessageSource.Key.recall
import net.mamoe.mirai.message.data.MessageSource.Key.recallIn
import net.mamoe.mirai.utils.MiraiExperimentalApi
import net.mamoe.mirai.utils.NotStableForInheritance
import net.mamoe.mirai.utils.safeCast
import java.util.stream.Stream
import kotlin.reflect.KProperty
@ -184,6 +185,7 @@ import kotlin.streams.asSequence
*
*/
@Serializable(MessageChain.Serializer::class)
@NotStableForInheritance
public sealed interface MessageChain :
Message, List<SingleMessage>, RandomAccess, CodableMessage {

View File

@ -1,10 +1,10 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
@file:JvmMultifileClass
@ -30,6 +30,7 @@ import net.mamoe.mirai.message.data.MessageSource.Key.quote
import net.mamoe.mirai.message.data.MessageSource.Key.recall
import net.mamoe.mirai.utils.LazyProperty
import net.mamoe.mirai.utils.MiraiInternalApi
import net.mamoe.mirai.utils.NotStableForInheritance
import net.mamoe.mirai.utils.safeCast
/**
@ -474,6 +475,7 @@ public sealed class OnlineMessageSource : MessageSource() { // TODO: 2021/1/10 E
public final override val fromId: Long get() = sender.id
public final override val targetId: Long get() = target.id
@NotStableForInheritance
public abstract class ToFriend @MiraiInternalApi constructor() : Outgoing() {
public companion object Key : AbstractPolymorphicMessageKey<Outgoing, ToFriend>(Outgoing, { it.safeCast() })
@ -482,6 +484,7 @@ public sealed class OnlineMessageSource : MessageSource() { // TODO: 2021/1/10 E
// final override fun toString(): String = "OnlineMessageSource.ToFriend(target=${target.ids})"
}
@NotStableForInheritance
public abstract class ToStranger @MiraiInternalApi constructor() : Outgoing() {
public companion object Key :
AbstractPolymorphicMessageKey<Outgoing, ToStranger>(Outgoing, { it.safeCast() })
@ -491,6 +494,7 @@ public sealed class OnlineMessageSource : MessageSource() { // TODO: 2021/1/10 E
// final override fun toString(): String = "OnlineMessageSource.ToFriend(target=${target.ids})"
}
@NotStableForInheritance
public abstract class ToTemp @MiraiInternalApi constructor() : Outgoing() {
public companion object Key : AbstractPolymorphicMessageKey<Outgoing, ToTemp>(Outgoing, { it.safeCast() })
@ -499,6 +503,7 @@ public sealed class OnlineMessageSource : MessageSource() { // TODO: 2021/1/10 E
public final override val subject: Member get() = target
}
@NotStableForInheritance
public abstract class ToGroup @MiraiInternalApi constructor() : Outgoing() {
public companion object Key : AbstractPolymorphicMessageKey<Outgoing, ToGroup>(Outgoing, { it.safeCast() })
@ -516,6 +521,7 @@ public sealed class OnlineMessageSource : MessageSource() { // TODO: 2021/1/10 E
public final override val fromId: Long get() = sender.id
public final override val targetId: Long get() = target.id
@NotStableForInheritance
public abstract class FromFriend @MiraiInternalApi constructor() : Incoming() {
public companion object Key :
AbstractPolymorphicMessageKey<Incoming, FromFriend>(Incoming, { it.safeCast() })
@ -526,6 +532,7 @@ public sealed class OnlineMessageSource : MessageSource() { // TODO: 2021/1/10 E
// final override fun toString(): String = "OnlineMessageSource.FromFriend(from=${sender.ids})"
}
@NotStableForInheritance
public abstract class FromTemp @MiraiInternalApi constructor() : Incoming() {
public companion object Key :
AbstractPolymorphicMessageKey<Incoming, FromTemp>(Incoming, { it.safeCast() })
@ -536,6 +543,7 @@ public sealed class OnlineMessageSource : MessageSource() { // TODO: 2021/1/10 E
public final override val target: Bot get() = sender.bot
}
@NotStableForInheritance
public abstract class FromStranger @MiraiInternalApi constructor() : Incoming() {
public companion object Key :
AbstractPolymorphicMessageKey<Incoming, FromStranger>(Incoming, { it.safeCast() })
@ -545,6 +553,7 @@ public sealed class OnlineMessageSource : MessageSource() { // TODO: 2021/1/10 E
public final override val target: Bot get() = sender.bot
}
@NotStableForInheritance
public abstract class FromGroup @MiraiInternalApi constructor() : Incoming() {
public companion object Key :
AbstractPolymorphicMessageKey<Incoming, FromGroup>(Incoming, { it.safeCast() })
@ -567,6 +576,7 @@ public sealed class OnlineMessageSource : MessageSource() { // TODO: 2021/1/10 E
*
* 要获得 [OfflineMessageSource], 使用 [MessageSourceBuilder]. 或通过 [OnlineMessageSource.toOffline] 转换得到 (一般没有必要).
*/
@NotStableForInheritance
public abstract class OfflineMessageSource : MessageSource() { // TODO: 2021/1/10 Extract to separate file in Kotlin 1.5
public companion object Key :
AbstractPolymorphicMessageKey<MessageSource, OfflineMessageSource>(MessageSource, { it.safeCast() })

View File

@ -1,10 +1,10 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
@file:JvmName("MessageUtils")
@ -18,6 +18,7 @@ import kotlinx.serialization.Serializable
import net.mamoe.mirai.message.code.CodableMessage
import net.mamoe.mirai.message.code.internal.appendStringAsMiraiCode
import net.mamoe.mirai.utils.MiraiExperimentalApi
import net.mamoe.mirai.utils.NotStableForInheritance
import net.mamoe.mirai.utils.safeCast
import kotlin.annotation.AnnotationTarget.*
@ -33,6 +34,7 @@ import kotlin.annotation.AnnotationTarget.*
*/
// not using sealed class for customized implementations
// using polymorphic serializer from Message.Serializer
@NotStableForInheritance
public interface RichMessage : MessageContent, ConstrainSingle {
override val key: MessageKey<RichMessage> get() = Key
@ -164,6 +166,7 @@ public class SimpleServiceMessage(
* @see LightApp 小程序类型消息
* @see SimpleServiceMessage
*/
@NotStableForInheritance
public interface ServiceMessage : RichMessage, CodableMessage {
public companion object Key :
AbstractPolymorphicMessageKey<RichMessage, ServiceMessage>(RichMessage, { it.safeCast() })

View File

@ -19,10 +19,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import net.mamoe.mirai.IMirai
import net.mamoe.mirai.Mirai
import net.mamoe.mirai.utils.chunkedHexToBytes
import net.mamoe.mirai.utils.copy
import net.mamoe.mirai.utils.map
import net.mamoe.mirai.utils.toUHexString
import net.mamoe.mirai.utils.*
/**
* mirai 尚未支持的消息类型.
@ -32,6 +29,7 @@ import net.mamoe.mirai.utils.toUHexString
*/
@SerialName(UnsupportedMessage.SERIAL_NAME)
@Serializable(UnsupportedMessage.Serializer::class)
@NotStableForInheritance
public interface UnsupportedMessage : MessageContent {
override fun contentToString(): String =
"[不支持的消息#${struct.contentHashCode()}]" // to produce 'stable' and reliable text

View File

@ -26,6 +26,7 @@ import net.mamoe.mirai.utils.ExternalResource.Companion.uploadAsVoice
*/
@Serializable
@MiraiExperimentalApi
@NotStableForInheritance
public abstract class PttMessage : MessageContent {
public companion object Key :

View File

@ -1,10 +1,10 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
package net.mamoe.mirai.utils
@ -53,6 +53,20 @@ public annotation class MiraiExperimentalApi(
public val message: String = ""
)
/**
* 标记一个定义在使用上是稳定的 (如果没有特殊说明), 但只应该由 mirai 内部实现.
*
* 用户自行实现将可能造成对未来版本的不兼容, 因为新的抽象函数或属性会在未经警告的前提下添加. 自行实现还可能因 mirai 内部实现有部分硬编码成分而不兼容.
*
* @since 2.7
*/
@Retention(AnnotationRetention.BINARY)
@Target(CLASS, PROPERTY, FUNCTION)
@MustBeDocumented
public annotation class NotStableForInheritance(
public val message: String = "This declaration is not stable for inheritance."
)
/**
* 标记一个正计划在 [version] 版本时删除 (对外隐藏) API.
*/

View File

@ -1,10 +1,10 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
@file:Suppress("unused")
@ -97,6 +97,7 @@ import java.io.File
* @see FileSupported
* @since 2.5
*/
@NotStableForInheritance
public interface RemoteFile {
/**
* 文件名或目录名.