From 956e193d020d50c34c4fd682ec3be16d642f1fb9 Mon Sep 17 00:00:00 2001 From: Him188 Date: Sat, 12 Sep 2020 13:31:34 +0800 Subject: [PATCH] Correct class naming following Kotlin formal style --- .../net/mamoe/mirai/console/MiraiConsole.kt | 16 ++++----- .../mirai/console/command/BuiltInCommands.kt | 10 +++--- .../mirai/console/command/CommandSender.kt | 8 ++--- .../mirai/console/command/CompositeCommand.kt | 4 +-- .../description/CommandArgumentContext.kt | 6 ++-- .../console/command/java/JCompositeCommand.kt | 4 +-- .../mirai/console/data/AutoSavePluginData.kt | 6 ++-- .../console/data/AutoSavePluginDataHolder.kt | 6 ++-- .../mamoe/mirai/console/data/PluginData.kt | 11 +++--- .../console/data/PluginDataExtensions.kt | 4 +-- .../mirai/console/data/PluginDataHolder.kt | 6 ++-- .../mirai/console/data/PluginDataStorage.kt | 12 +++---- .../net/mamoe/mirai/console/data/Value.kt | 34 +++++++++---------- .../mirai/console/extension/Extension.kt | 10 +++--- .../mirai/console/extension/ExtensionPoint.kt | 14 ++++---- .../extensions/SingletonExtensionSelector.kt | 4 +-- .../MiraiConsoleImplementationBridge.kt | 6 ++-- .../data/MultiFilePluginDataStorageImpl.kt | 4 +-- .../permission/PermissibleIdentifier.kt | 4 +-- .../mirai/console/permission/Permission.kt | 4 +-- .../console/plugin/center/PluginCenter.kt | 8 ++--- .../console/plugin/jvm/AbstractJvmPlugin.kt | 6 ++-- .../console/plugin/jvm/JarPluginLoader.kt | 8 ++--- .../mamoe/mirai/console/util/Annotations.kt | 10 +++--- .../mamoe/mirai/console/util/ContactUtils.kt | 10 +++--- .../mirai/console/util/CoroutineScopeUtils.kt | 10 +++--- .../mamoe/mirai/console/util/MessageScope.kt | 2 +- .../mamoe/mirai/console/TestMiraiConosle.kt | 8 ++--- .../mamoe/mirai/console/data/SettingTest.kt | 4 +-- buildSrc/src/main/kotlin/Versions.kt | 2 +- .../mamoe/mirai/console/pure/ConsoleThread.kt | 4 +-- .../pure/MiraiConsoleImplementationPure.kt | 8 ++--- .../console/pure/MiraiConsolePureLoader.kt | 12 +++---- 33 files changed, 132 insertions(+), 133 deletions(-) diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/MiraiConsole.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/MiraiConsole.kt index e82df754f..87cd2f6c8 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/MiraiConsole.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/MiraiConsole.kt @@ -8,7 +8,7 @@ */ @file:Suppress("WRONG_MODIFIER_CONTAINING_DECLARATION", "unused") -@file:OptIn(ConsoleInternalAPI::class) +@file:OptIn(ConsoleInternalApi::class) package net.mamoe.mirai.console @@ -25,8 +25,8 @@ import net.mamoe.mirai.console.plugin.PluginLoader import net.mamoe.mirai.console.plugin.PluginManager import net.mamoe.mirai.console.plugin.center.PluginCenter import net.mamoe.mirai.console.plugin.jvm.JarPluginLoader -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI -import net.mamoe.mirai.console.util.ConsoleInternalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi +import net.mamoe.mirai.console.util.ConsoleInternalApi import net.mamoe.mirai.console.util.CoroutineScopeUtils.childScopeContext import net.mamoe.mirai.utils.BotConfiguration import net.mamoe.mirai.utils.MiraiLogger @@ -60,7 +60,7 @@ public interface MiraiConsole : CoroutineScope { * * **注意**: 插件不应该在任何时刻使用它. */ - @ConsoleInternalAPI + @ConsoleInternalApi public val mainLogger: MiraiLogger /** @@ -80,13 +80,13 @@ public interface MiraiConsole : CoroutineScope { */ public val version: Semver - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public val pluginCenter: PluginCenter /** * 创建一个 logger */ - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public fun createLogger(identity: String?): MiraiLogger public companion object INSTANCE : MiraiConsole by MiraiConsoleImplementationBridge { @@ -106,7 +106,7 @@ public interface MiraiConsole : CoroutineScope { * @see BotConfigurationAlterer ExtensionPoint */ // don't static - @ConsoleExperimentalAPI("This is a low-level API and might be removed in the future.") + @ConsoleExperimentalApi("This is a low-level API and might be removed in the future.") public fun addBot(id: Long, password: String, configuration: BotConfiguration.() -> Unit = {}): Bot = addBotImpl(id, password, configuration) @@ -118,7 +118,7 @@ public interface MiraiConsole : CoroutineScope { * @see Bot.botInstances 获取现有 [Bot] 实例列表 * @see BotConfigurationAlterer ExtensionPoint */ - @ConsoleExperimentalAPI("This is a low-level API and might be removed in the future.") + @ConsoleExperimentalApi("This is a low-level API and might be removed in the future.") public fun addBot(id: Long, password: ByteArray, configuration: BotConfiguration.() -> Unit = {}): Bot = addBotImpl(id, password, configuration) diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/BuiltInCommands.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/BuiltInCommands.kt index 770b9dbb3..ad390ef01 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/BuiltInCommands.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/BuiltInCommands.kt @@ -25,8 +25,8 @@ import net.mamoe.mirai.console.permission.PermissionService.Companion.denyPermis import net.mamoe.mirai.console.permission.PermissionService.Companion.findCorrespondingPermissionOrFail import net.mamoe.mirai.console.permission.PermissionService.Companion.getGrantedPermissions import net.mamoe.mirai.console.permission.PermissionService.Companion.grantPermission -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI -import net.mamoe.mirai.console.util.ConsoleInternalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi +import net.mamoe.mirai.console.util.ConsoleInternalApi import net.mamoe.mirai.contact.* import net.mamoe.mirai.event.events.EventCancelledException import net.mamoe.mirai.message.nextMessageOrNull @@ -35,7 +35,7 @@ import kotlin.concurrent.thread import kotlin.system.exitProcess -@ConsoleExperimentalAPI +@ConsoleExperimentalApi @Suppress("EXPOSED_SUPER_INTERFACE") public interface BuiltInCommand : Command, BuiltInCommandInternal @@ -45,7 +45,7 @@ internal interface BuiltInCommandInternal : Command /** * 内建指令列表 */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi @Suppress("unused") @OptIn(ExperimentalPermission::class) public object BuiltInCommands { @@ -101,7 +101,7 @@ public object BuiltInCommands { }, onFailure = { if (it is CancellationException) return@fold - @OptIn(ConsoleInternalAPI::class) + @OptIn(ConsoleInternalApi::class) MiraiConsole.mainLogger.error("Exception in stop", it) ignoreException { sendMessage( diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/CommandSender.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/CommandSender.kt index af199bcb4..1aa13de3d 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/CommandSender.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/CommandSender.kt @@ -36,7 +36,7 @@ import net.mamoe.mirai.console.permission.AbstractPermissibleIdentifier import net.mamoe.mirai.console.permission.ExperimentalPermission import net.mamoe.mirai.console.permission.Permissible import net.mamoe.mirai.console.permission.PermissibleIdentifier -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi import net.mamoe.mirai.console.util.CoroutineScopeUtils.childScope import net.mamoe.mirai.console.util.CoroutineScopeUtils.childScopeContext import net.mamoe.mirai.console.util.MessageScope @@ -180,7 +180,7 @@ public interface CommandSender : CoroutineScope, Permissible { @JvmBlockingBridge public suspend fun sendMessage(message: String): MessageReceipt? - @ConsoleExperimentalAPI("This is unstable and might get changed") + @ConsoleExperimentalApi("This is unstable and might get changed") public suspend fun catchExecutionException(e: Throwable) public companion object { @@ -282,7 +282,7 @@ public sealed class AbstractCommandSender : CommandSender, CoroutineScope { public abstract override val user: User? public abstract override fun toString(): String - @ConsoleExperimentalAPI("This is unstable and might get changed") + @ConsoleExperimentalApi("This is unstable and might get changed") override suspend fun catchExecutionException(e: Throwable) { if (this is CommandSenderOnMessage<*>) { val cause = e.rootCauseOrSelf @@ -469,7 +469,7 @@ public inline fun CommandSender.fold( * @return [inGroup] 或 [inPrivate] 执行结果. */ @JvmSynthetic -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public inline fun UserCommandSender.foldContext( inGroup: MemberCommandSender.() -> R, inPrivate: UserCommandSender.() -> R, diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/CompositeCommand.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/CompositeCommand.kt index 7cea5b132..bf3fe97f5 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/CompositeCommand.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/CompositeCommand.kt @@ -22,7 +22,7 @@ import net.mamoe.mirai.console.internal.command.AbstractReflectionCommand import net.mamoe.mirai.console.internal.command.CompositeCommandSubCommandAnnotationResolver import net.mamoe.mirai.console.permission.ExperimentalPermission import net.mamoe.mirai.console.permission.Permission -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi import net.mamoe.mirai.message.data.MessageChain import kotlin.annotation.AnnotationRetention.RUNTIME import kotlin.annotation.AnnotationTarget.FUNCTION @@ -81,7 +81,7 @@ import kotlin.annotation.AnnotationTarget.FUNCTION * * @see buildCommandArgumentContext */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public abstract class CompositeCommand @OptIn(ExperimentalPermission::class) constructor( owner: CommandOwner, vararg names: String, diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/description/CommandArgumentContext.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/description/CommandArgumentContext.kt index f02c4e39d..e071fd0ff 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/description/CommandArgumentContext.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/description/CommandArgumentContext.kt @@ -16,7 +16,7 @@ import net.mamoe.mirai.console.command.CommandSender import net.mamoe.mirai.console.command.CompositeCommand import net.mamoe.mirai.console.command.SimpleCommand import net.mamoe.mirai.console.command.description.CommandArgumentContext.ParserPair -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi import net.mamoe.mirai.contact.* import kotlin.internal.LowPriorityInOverloadResolution import kotlin.reflect.KClass @@ -238,7 +238,7 @@ public class CommandArgumentContextBuilder : MutableList> by mutab /** * 添加一个指令解析器 */ - @ConsoleExperimentalAPI + @ConsoleExperimentalApi @JvmSynthetic public inline infix fun add( crossinline parser: CommandArgumentParser<*>.(s: String) -> T @@ -249,7 +249,7 @@ public class CommandArgumentContextBuilder : MutableList> by mutab /** * 添加一个指令解析器 */ - @ConsoleExperimentalAPI + @ConsoleExperimentalApi @JvmSynthetic @LowPriorityInOverloadResolution public inline infix fun add( diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/java/JCompositeCommand.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/java/JCompositeCommand.kt index 6ce98456a..2c62b5959 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/java/JCompositeCommand.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/java/JCompositeCommand.kt @@ -16,7 +16,7 @@ import net.mamoe.mirai.console.command.CompositeCommand import net.mamoe.mirai.console.command.description.buildCommandArgumentContext import net.mamoe.mirai.console.permission.ExperimentalPermission import net.mamoe.mirai.console.permission.Permission -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi /** * 复合指令. 指令注册时候会通过反射构造指令解析器. @@ -68,7 +68,7 @@ import net.mamoe.mirai.console.util.ConsoleExperimentalAPI * * @see buildCommandArgumentContext */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public abstract class JCompositeCommand @OptIn(ExperimentalPermission::class) @JvmOverloads constructor( owner: CommandOwner, diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/AutoSavePluginData.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/AutoSavePluginData.kt index 662242882..85e45bc10 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/AutoSavePluginData.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/AutoSavePluginData.kt @@ -16,7 +16,7 @@ import kotlinx.coroutines.* import net.mamoe.mirai.console.MiraiConsole import net.mamoe.mirai.console.internal.command.qualifiedNameOrTip import net.mamoe.mirai.console.internal.plugin.updateWhen -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi import net.mamoe.mirai.utils.* /** @@ -38,7 +38,7 @@ public open class AutoSavePluginData private constructor( public constructor() : this(null) - @ConsoleExperimentalAPI + @ConsoleExperimentalApi override fun onInit(owner: PluginDataHolder, storage: PluginDataStorage) { check(owner is AutoSavePluginDataHolder) { "owner must be AutoSavePluginDataHolder for AutoSavePluginData" } @@ -89,7 +89,7 @@ public open class AutoSavePluginData private constructor( /** * @return `true` 时, 一段时间后, 即使无属性改变, 也会进行保存. */ - @ConsoleExperimentalAPI + @ConsoleExperimentalApi protected open fun shouldPerformAutoSaveWheneverChanged(): Boolean { return true } diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/AutoSavePluginDataHolder.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/AutoSavePluginDataHolder.kt index 5b4265865..2237e1ec7 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/AutoSavePluginDataHolder.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/AutoSavePluginDataHolder.kt @@ -3,7 +3,7 @@ package net.mamoe.mirai.console.data import kotlinx.coroutines.CoroutineExceptionHandler import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Job -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi /** * 可以持有相关 [AutoSavePluginData] 的对象. @@ -13,7 +13,7 @@ import net.mamoe.mirai.console.util.ConsoleExperimentalAPI * * @see net.mamoe.mirai.console.plugin.jvm.JvmPlugin */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface AutoSavePluginDataHolder : PluginDataHolder, CoroutineScope { /** * [AutoSavePluginData] 每次自动保存时间间隔 @@ -27,6 +27,6 @@ public interface AutoSavePluginDataHolder : PluginDataHolder, CoroutineScope { * @see LongRange Java 用户使用 [LongRange] 的构造器创建 * @see Long.rangeTo Kotlin 用户使用 [Long.rangeTo] 创建, 如 `3000..50000` */ - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public val autoSaveIntervalMillis: LongRange } \ No newline at end of file diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/PluginData.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/PluginData.kt index 08f44ceb3..d4004c82f 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/PluginData.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/PluginData.kt @@ -21,8 +21,7 @@ import kotlinx.serialization.KSerializer import net.mamoe.mirai.console.data.java.JAutoSavePluginData import net.mamoe.mirai.console.internal.data.* import net.mamoe.mirai.console.plugin.jvm.JvmPlugin -import net.mamoe.mirai.console.plugin.jvm.reloadPluginData -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi import kotlin.internal.LowPriorityInOverloadResolution import kotlin.reflect.KClass import kotlin.reflect.KProperty @@ -117,7 +116,7 @@ public interface PluginData { /** * 这个 [PluginData] 保存时使用的名称. 默认通过 [ValueName] 获取, 否则使用 [类全名][KClass.qualifiedName] (即 [Class.getCanonicalName]) */ - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public val saveName: String get() { val clazz = this::class @@ -129,7 +128,7 @@ public interface PluginData { /** * 由 [provideDelegate] 创建, 来自一个通过 `by value` 初始化的属性节点. */ - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public data class ValueNode( /** * 节点名称. @@ -191,7 +190,7 @@ public interface PluginData { /** * 当这个 [PluginData] 被放入一个 [PluginDataStorage] 时调用 */ - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public fun onInit(owner: PluginDataHolder, storage: PluginDataStorage) } @@ -346,6 +345,6 @@ internal fun PluginData.valueImpl(type: KType, classifier: KClass<*>): Seria * - 使用 [kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization) 的 [Serializable] 标记的类 */ @Suppress("UNCHECKED_CAST") -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public fun PluginData.valueFromKType(type: KType, default: T): SerializerAwareValue = (valueFromKTypeImpl(type) as SerializerAwareValue).apply { this.value = default } as SerializerAwareValue diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/PluginDataExtensions.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/PluginDataExtensions.kt index 3a610c6f5..654687d49 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/PluginDataExtensions.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/PluginDataExtensions.kt @@ -4,7 +4,7 @@ package net.mamoe.mirai.console.data import net.mamoe.mirai.console.data.PluginDataExtensions.withDefault import net.mamoe.mirai.console.internal.data.ShadowMap -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi import kotlin.internal.LowPriorityInOverloadResolution /** @@ -12,7 +12,7 @@ import kotlin.internal.LowPriorityInOverloadResolution */ public object PluginDataExtensions { - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public open class NotNullMap internal constructor( private val delegate: Map ) : Map by delegate { diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/PluginDataHolder.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/PluginDataHolder.kt index 2c89f3587..06d655913 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/PluginDataHolder.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/PluginDataHolder.kt @@ -11,7 +11,7 @@ package net.mamoe.mirai.console.data -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi /** * 可以持有相关 [PluginData] 实例的对象, 作为 [PluginData] 实例的拥有者. @@ -21,12 +21,12 @@ import net.mamoe.mirai.console.util.ConsoleExperimentalAPI * * @see AutoSavePluginDataHolder 支持自动保存 */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface PluginDataHolder { /** * 保存时使用的分类名 */ - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public val dataHolderName: String } diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/PluginDataStorage.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/PluginDataStorage.kt index 112ceebda..05c10facf 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/PluginDataStorage.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/PluginDataStorage.kt @@ -15,7 +15,7 @@ import net.mamoe.mirai.console.internal.data.MemoryPluginDataStorageImpl import net.mamoe.mirai.console.internal.data.MultiFilePluginDataStorageImpl import net.mamoe.mirai.console.plugin.jvm.JarPluginLoader import net.mamoe.mirai.console.plugin.jvm.JvmPlugin -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi import java.io.File import java.nio.file.Path @@ -33,12 +33,12 @@ import java.nio.file.Path * @see PluginDataHolder * @see JarPluginLoader.dataStorage */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface PluginDataStorage { /** * 读取一个实例. 并为 [instance] [设置 [PluginDataStorage]][PluginData.onInit] */ - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public fun load(holder: PluginDataHolder, instance: PluginData) /** @@ -46,7 +46,7 @@ public interface PluginDataStorage { * * **实现细节**: 调用 [PluginData.updaterSerializer] */ - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public fun store(holder: PluginDataHolder, instance: PluginData) /* @@ -96,7 +96,7 @@ public companion object { * 在内存存储所有 [PluginData] 实例的 [PluginDataStorage]. 在内存数据丢失后相关 [PluginData] 实例也会丢失. * @see PluginDataStorage */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface MemoryPluginDataStorage : PluginDataStorage { public companion object { /** @@ -112,7 +112,7 @@ public interface MemoryPluginDataStorage : PluginDataStorage { /** * 用多个文件存储 [PluginData] 实例的 [PluginDataStorage]. */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface MultiFilePluginDataStorage : PluginDataStorage { /** * 存放 [PluginData] 的目录. diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/Value.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/Value.kt index 95ff1850a..14bc75e65 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/Value.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/Value.kt @@ -16,7 +16,7 @@ import kotlinx.serialization.KSerializer import kotlinx.serialization.StringFormat import net.mamoe.mirai.console.internal.data.map import net.mamoe.mirai.console.internal.data.setValueBySerializer -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty @@ -212,7 +212,7 @@ public interface StringValue : PrimitiveValue /** * 复合数据类型实现 */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface CompositeValue : Value @@ -227,7 +227,7 @@ public interface ListValue : CompositeValue> * * @param E 不是基础数据类型 */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface CompositeListValue : ListValue /** @@ -235,16 +235,16 @@ public interface CompositeListValue : ListValue * * @param E 是基础类型 */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface PrimitiveListValue : ListValue //// region PrimitiveListValue CODEGEN //// -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface PrimitiveIntListValue : PrimitiveListValue -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface PrimitiveLongListValue : PrimitiveListValue // TODO + codegen @@ -255,30 +255,30 @@ public interface PrimitiveLongListValue : PrimitiveListValue * @see [CompositeSetValue] * @see [PrimitiveSetValue] */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface SetValue : CompositeValue> /** * 复合数据类型 [Set] * @param E 是基础数据类型 */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface CompositeSetValue : SetValue /** * 基础数据类型 [Set] * @param E 是基础数据类型 */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface PrimitiveSetValue : SetValue //// region PrimitiveSetValue CODEGEN //// -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface PrimitiveIntSetValue : PrimitiveSetValue -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface PrimitiveLongSetValue : PrimitiveSetValue // TODO + codegen @@ -289,27 +289,27 @@ public interface PrimitiveLongSetValue : PrimitiveSetValue * @see [CompositeMapValue] * @see [PrimitiveMapValue] */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface MapValue : CompositeValue> -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface CompositeMapValue : MapValue -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface PrimitiveMapValue : MapValue //// region PrimitiveMapValue CODEGEN //// -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface PrimitiveIntIntMapValue : PrimitiveMapValue -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface PrimitiveIntLongMapValue : PrimitiveMapValue // TODO + codegen //// endregion PrimitiveSetValue CODEGEN //// -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface ReferenceValue : Value \ No newline at end of file diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extension/Extension.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extension/Extension.kt index 62705a203..7cf54a405 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extension/Extension.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extension/Extension.kt @@ -13,18 +13,18 @@ import net.mamoe.mirai.console.extensions.PermissionServiceProvider import net.mamoe.mirai.console.extensions.PluginLoaderProvider import net.mamoe.mirai.console.extensions.SingletonExtensionSelector import net.mamoe.mirai.console.extensions.SingletonExtensionSelector.ExtensionPoint.selectSingleton -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi /** * 表示一个扩展. */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface Extension /** * 增加一些函数 (方法)的扩展 */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface FunctionExtension : Extension /** @@ -34,7 +34,7 @@ public interface FunctionExtension : Extension * * @see PermissionServiceProvider */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface SingletonExtension : Extension { public val instance: T } @@ -44,7 +44,7 @@ public interface SingletonExtension : Extension { * * @see PluginLoaderProvider */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface InstanceExtension : Extension { public val instance: T } diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extension/ExtensionPoint.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extension/ExtensionPoint.kt index 8a35055bb..6fda56d81 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extension/ExtensionPoint.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extension/ExtensionPoint.kt @@ -12,18 +12,18 @@ package net.mamoe.mirai.console.extension import net.mamoe.mirai.console.plugin.PluginLoader -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi import kotlin.reflect.KClass import kotlin.reflect.full.isSubclassOf -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface ExtensionPoint { public val type: KClass public companion object { @JvmStatic @JvmSynthetic - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public inline fun ExtensionPoint<*>.isFor(exactType: Boolean = false): Boolean { return if (exactType) { T::class == type @@ -32,15 +32,15 @@ public interface ExtensionPoint { } } -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface SingletonExtensionPoint> : ExtensionPoint /** * 表示一个扩展点 */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public open class AbstractExtensionPoint( - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public override val type: KClass, ) : ExtensionPoint @@ -53,7 +53,7 @@ public open class AbstractExtensionPoint( * @see PluginLoader.disable * @see PluginLoader.description */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public open class ExtensionException : RuntimeException { public constructor() : super() public constructor(message: String?) : super(message) diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/SingletonExtensionSelector.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/SingletonExtensionSelector.kt index 49adf4239..da4bb2261 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/SingletonExtensionSelector.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/SingletonExtensionSelector.kt @@ -14,7 +14,7 @@ import net.mamoe.mirai.console.extension.* import net.mamoe.mirai.console.internal.extensions.BuiltInSingletonExtensionSelector import net.mamoe.mirai.console.plugin.Plugin import net.mamoe.mirai.console.plugin.name -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi import net.mamoe.mirai.utils.info import kotlin.reflect.KClass @@ -23,7 +23,7 @@ import kotlin.reflect.KClass * * 如有多个 [SingletonExtensionSelector] 注册, 将会停止服务器. */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface SingletonExtensionSelector : FunctionExtension { public data class Registry( val plugin: Plugin, diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/MiraiConsoleImplementationBridge.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/MiraiConsoleImplementationBridge.kt index a15c3955c..7109b7c0e 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/MiraiConsoleImplementationBridge.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/MiraiConsoleImplementationBridge.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -@file:OptIn(ConsoleExperimentalAPI::class) +@file:OptIn(ConsoleExperimentalApi::class) package net.mamoe.mirai.console.internal @@ -47,7 +47,7 @@ import net.mamoe.mirai.console.plugin.PluginLoader import net.mamoe.mirai.console.plugin.PluginManager import net.mamoe.mirai.console.plugin.center.PluginCenter import net.mamoe.mirai.console.plugin.jvm.AbstractJvmPlugin -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi import net.mamoe.mirai.console.util.ConsoleInput import net.mamoe.mirai.utils.* import java.nio.file.Path @@ -93,7 +93,7 @@ internal object MiraiConsoleImplementationBridge : CoroutineScope, MiraiConsoleI override fun createLogger(identity: String?): MiraiLogger = instance.createLogger(identity) - @OptIn(ConsoleExperimentalAPI::class, ExperimentalPermission::class) + @OptIn(ConsoleExperimentalApi::class, ExperimentalPermission::class) @Suppress("RemoveRedundantBackticks") internal fun doStart() { phase `greeting`@{ diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/MultiFilePluginDataStorageImpl.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/MultiFilePluginDataStorageImpl.kt index bfb93c4c5..8b8abc116 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/MultiFilePluginDataStorageImpl.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/MultiFilePluginDataStorageImpl.kt @@ -15,7 +15,7 @@ import net.mamoe.mirai.console.data.PluginDataHolder import net.mamoe.mirai.console.data.PluginDataStorage import net.mamoe.mirai.console.internal.command.qualifiedNameOrTip import net.mamoe.mirai.console.permission.ExperimentalPermission -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi import net.mamoe.mirai.utils.MiraiLogger import net.mamoe.mirai.utils.SilentLogger import net.mamoe.mirai.utils.debug @@ -63,7 +63,7 @@ internal open class MultiFilePluginDataStorageImpl( return file.toFile().also { it.createNewFile() } } - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public override fun store(holder: PluginDataHolder, instance: PluginData) { @OptIn(ExperimentalPermission::class) val yaml =/* if (instance.saveName == "PermissionService") Json { diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/PermissibleIdentifier.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/PermissibleIdentifier.kt index 695b8cc97..6db38f796 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/PermissibleIdentifier.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/PermissibleIdentifier.kt @@ -15,7 +15,7 @@ import kotlinx.serialization.KSerializer import kotlinx.serialization.Serializable import kotlinx.serialization.builtins.serializer import net.mamoe.mirai.console.internal.data.map -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi /** */ @@ -109,7 +109,7 @@ public sealed class AbstractPermissibleIdentifier( } } - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public object AsStringSerializer : KSerializer by String.serializer().map( serializer = { it.toString() }, diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/Permission.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/Permission.kt index 78cb76515..e251b77de 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/Permission.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/Permission.kt @@ -9,7 +9,7 @@ package net.mamoe.mirai.console.permission -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi /** @@ -49,7 +49,7 @@ public val RootConsoleBuiltInPermission: Permission by lazy { ) } -@ConsoleExperimentalAPI +@ConsoleExperimentalApi @ExperimentalPermission public fun Permission.parentsWithSelfSequence(): Sequence = generateSequence(this) { p -> diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/center/PluginCenter.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/center/PluginCenter.kt index 30ac29a0c..0f1791400 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/center/PluginCenter.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/center/PluginCenter.kt @@ -11,14 +11,14 @@ package net.mamoe.mirai.console.plugin.center import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi import java.io.File -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public interface PluginCenter { @Serializable - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public data class PluginInsight( val name: String, val version: String, @@ -32,7 +32,7 @@ public interface PluginCenter { val commands: List ) - @ConsoleExperimentalAPI + @ConsoleExperimentalApi @Serializable public data class PluginInfo( val name: String, diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/jvm/AbstractJvmPlugin.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/jvm/AbstractJvmPlugin.kt index 2fd32ea9f..23e63ab7a 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/jvm/AbstractJvmPlugin.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/jvm/AbstractJvmPlugin.kt @@ -15,7 +15,7 @@ import net.mamoe.mirai.console.data.AutoSavePluginDataHolder import net.mamoe.mirai.console.data.PluginConfig import net.mamoe.mirai.console.data.PluginData import net.mamoe.mirai.console.internal.plugin.JvmPluginInternal -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi import net.mamoe.mirai.utils.minutesToMillis import net.mamoe.mirai.utils.secondsToMillis import kotlin.coroutines.CoroutineContext @@ -30,7 +30,7 @@ import kotlin.coroutines.EmptyCoroutineContext public abstract class AbstractJvmPlugin @JvmOverloads constructor( parentCoroutineContext: CoroutineContext = EmptyCoroutineContext, ) : JvmPlugin, JvmPluginInternal(parentCoroutineContext), AutoSavePluginDataHolder { - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public final override val dataHolderName: String get() = this.description.name @@ -52,7 +52,7 @@ public abstract class AbstractJvmPlugin @JvmOverloads constructor( @JvmName("reloadPluginConfig") public fun T.reload(): Unit = loader.configStorage.load(this@AbstractJvmPlugin, this) - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public override val autoSaveIntervalMillis: LongRange = 30.secondsToMillis..10.minutesToMillis } diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/jvm/JarPluginLoader.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/jvm/JarPluginLoader.kt index 35b83b8fe..160dbf5cc 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/jvm/JarPluginLoader.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/jvm/JarPluginLoader.kt @@ -13,23 +13,23 @@ import kotlinx.coroutines.CoroutineScope import net.mamoe.mirai.console.data.PluginDataStorage import net.mamoe.mirai.console.internal.plugin.JarPluginLoaderImpl import net.mamoe.mirai.console.plugin.FilePluginLoader -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi /** * 内建的 Jar (JVM) 插件加载器 */ -@ConsoleExperimentalAPI("classname might change") +@ConsoleExperimentalApi("classname might change") public interface JarPluginLoader : CoroutineScope, FilePluginLoader { /** * [JvmPlugin.reloadPluginData] 默认使用的实例 */ - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public val dataStorage: PluginDataStorage /** * [JvmPlugin.reloadPluginData] 默认使用的实例 */ - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public val configStorage: PluginDataStorage public companion object INSTANCE : JarPluginLoader by JarPluginLoaderImpl { diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/Annotations.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/Annotations.kt index 4a0e7b595..161120038 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/Annotations.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/Annotations.kt @@ -20,7 +20,7 @@ import kotlin.annotation.AnnotationTarget.* @Retention(AnnotationRetention.SOURCE) @RequiresOptIn(level = RequiresOptIn.Level.ERROR) @Target(PROPERTY, FUNCTION, TYPE, CLASS) -internal annotation class JavaFriendlyAPI +internal annotation class JavaFriendlyApi /** * 标记为一个仅供 mirai-console 内部使用的 API. @@ -32,8 +32,8 @@ internal annotation class JavaFriendlyAPI @RequiresOptIn(level = RequiresOptIn.Level.ERROR) @Target(CLASS, TYPEALIAS, FUNCTION, PROPERTY, FIELD, CONSTRUCTOR, CLASS, FUNCTION, PROPERTY) @MustBeDocumented -public annotation class ConsoleInternalAPI( - val message: String = "" +public annotation class ConsoleInternalApi( + val message: String = "", ) /** @@ -46,6 +46,6 @@ public annotation class ConsoleInternalAPI( @RequiresOptIn(level = RequiresOptIn.Level.WARNING) @Target(CLASS, TYPEALIAS, FUNCTION, PROPERTY, FIELD, CONSTRUCTOR) @MustBeDocumented -public annotation class ConsoleExperimentalAPI( - val message: String = "" +public annotation class ConsoleExperimentalApi( + val message: String = "", ) \ No newline at end of file diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/ContactUtils.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/ContactUtils.kt index 8478bc38b..825d7b89a 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/ContactUtils.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/ContactUtils.kt @@ -18,7 +18,7 @@ import net.mamoe.mirai.contact.Member /** * 为简化操作提供的一些工具 */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public object ContactUtils { /** * 获取一个 [Bot] 的好友, 群, 或群员. @@ -31,7 +31,7 @@ public object ContactUtils { */ @JvmOverloads @JvmStatic - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public fun Bot.getContact(id: Long, includeMembers: Boolean = false): Contact { return getContactOrNull(id, includeMembers) ?: throw NoSuchElementException("Contact $id not found for bot ${this.id}") @@ -44,7 +44,7 @@ public object ContactUtils { */ @JvmOverloads @JvmStatic - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public fun Bot.getContactOrNull(id: Long, includeMembers: Boolean = false): Contact? { return getFriendOrGroupOrNull(id) ?: kotlin.run { if (includeMembers) { @@ -60,7 +60,7 @@ public object ContactUtils { * 访问顺序为 [Bot.friends] -> [Bot.groups] */ @JvmStatic - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public fun Bot.getFriendOrGroup(id: Long): Contact { return getFriendOrGroupOrNull(id) ?: throw NoSuchElementException("Friend or Group $id not found for bot ${this.id}") @@ -72,7 +72,7 @@ public object ContactUtils { * 访问顺序为 [Bot.friends] -> [Bot.groups] */ @JvmStatic - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public fun Bot.getFriendOrGroupOrNull(id: Long): Contact? { return this.friends.getOrNull(id) ?: this.groups.getOrNull(id) } diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/CoroutineScopeUtils.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/CoroutineScopeUtils.kt index 647ca62e4..ee2917b80 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/CoroutineScopeUtils.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/CoroutineScopeUtils.kt @@ -15,15 +15,15 @@ import kotlinx.coroutines.* import kotlin.coroutines.CoroutineContext import kotlin.coroutines.EmptyCoroutineContext -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public object CoroutineScopeUtils { @JvmStatic - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public fun CoroutineContext.overrideWithSupervisorJob(name: String? = null): CoroutineContext = this + NamedSupervisorJob(name ?: "", this[Job]) @JvmStatic - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public fun CoroutineScope.childScope( name: String? = null, context: CoroutineContext = EmptyCoroutineContext @@ -31,7 +31,7 @@ public object CoroutineScopeUtils { CoroutineScope(this.childScopeContext(name, context)) @JvmStatic - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public fun CoroutineScope.childScopeContext( name: String? = null, context: CoroutineContext = EmptyCoroutineContext @@ -42,7 +42,7 @@ public object CoroutineScopeUtils { } } -@ConsoleExperimentalAPI +@ConsoleExperimentalApi public class NamedSupervisorJob @JvmOverloads constructor( private val name: String, parent: Job? = null diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/MessageScope.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/MessageScope.kt index 91309fbba..d10324141 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/MessageScope.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/MessageScope.kt @@ -104,7 +104,7 @@ public interface MessageScope { * * @suppress 此 API 不稳定, 可能在任何时间被修改 */ - @ConsoleExperimentalAPI + @ConsoleExperimentalApi public val realTarget: Any? /** diff --git a/backend/mirai-console/src/test/kotlin/net/mamoe/mirai/console/TestMiraiConosle.kt b/backend/mirai-console/src/test/kotlin/net/mamoe/mirai/console/TestMiraiConosle.kt index 919a4b229..68605851e 100644 --- a/backend/mirai-console/src/test/kotlin/net/mamoe/mirai/console/TestMiraiConosle.kt +++ b/backend/mirai-console/src/test/kotlin/net/mamoe/mirai/console/TestMiraiConosle.kt @@ -18,9 +18,9 @@ import net.mamoe.mirai.console.data.PluginDataStorage import net.mamoe.mirai.console.plugin.DeferredPluginLoader import net.mamoe.mirai.console.plugin.PluginLoader import net.mamoe.mirai.console.plugin.jvm.JarPluginLoader -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi import net.mamoe.mirai.console.util.ConsoleInput -import net.mamoe.mirai.console.util.ConsoleInternalAPI +import net.mamoe.mirai.console.util.ConsoleInternalApi import net.mamoe.mirai.message.data.Message import net.mamoe.mirai.utils.BotConfiguration import net.mamoe.mirai.utils.LoginSolver @@ -32,12 +32,12 @@ import kotlin.coroutines.CoroutineContext import kotlin.coroutines.resume import kotlin.test.assertNotNull -@OptIn(ConsoleInternalAPI::class) +@OptIn(ConsoleInternalApi::class) fun initTestEnvironment() { object : MiraiConsoleImplementation { override val rootPath: Path = createTempDir().toPath() - @ConsoleExperimentalAPI + @ConsoleExperimentalApi override val frontEndDescription: MiraiConsoleFrontEndDescription get() = object : MiraiConsoleFrontEndDescription { override val name: String diff --git a/backend/mirai-console/src/test/kotlin/net/mamoe/mirai/console/data/SettingTest.kt b/backend/mirai-console/src/test/kotlin/net/mamoe/mirai/console/data/SettingTest.kt index 861101fd1..c8f6cde4f 100644 --- a/backend/mirai-console/src/test/kotlin/net/mamoe/mirai/console/data/SettingTest.kt +++ b/backend/mirai-console/src/test/kotlin/net/mamoe/mirai/console/data/SettingTest.kt @@ -12,12 +12,12 @@ package net.mamoe.mirai.console.data import kotlinx.serialization.json.Json import net.mamoe.mirai.console.plugin.jvm.JvmPluginDescription import net.mamoe.mirai.console.plugin.jvm.KotlinPlugin -import net.mamoe.mirai.console.util.ConsoleInternalAPI +import net.mamoe.mirai.console.util.ConsoleInternalApi import org.junit.jupiter.api.Test import kotlin.test.assertEquals import kotlin.test.assertSame -@OptIn(ConsoleInternalAPI::class) +@OptIn(ConsoleInternalApi::class) internal class PluginDataTest { object MyPlugin : KotlinPlugin( diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index abb6b862a..069901671 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -17,7 +17,7 @@ */ object Versions { - const val core = "1.2.2" + const val core = "1.2.3" const val console = "1.0-M4-dev-5" const val consoleGraphical = "0.0.7" const val consoleTerminal = "0.1.0" diff --git a/frontend/mirai-console-pure/src/main/kotlin/net/mamoe/mirai/console/pure/ConsoleThread.kt b/frontend/mirai-console-pure/src/main/kotlin/net/mamoe/mirai/console/pure/ConsoleThread.kt index dd1bd9133..ef82f3c65 100644 --- a/frontend/mirai-console-pure/src/main/kotlin/net/mamoe/mirai/console/pure/ConsoleThread.kt +++ b/frontend/mirai-console-pure/src/main/kotlin/net/mamoe/mirai/console/pure/ConsoleThread.kt @@ -20,14 +20,14 @@ import net.mamoe.mirai.console.command.CommandExecuteStatus import net.mamoe.mirai.console.command.CommandManager import net.mamoe.mirai.console.command.CommandManager.INSTANCE.executeCommand import net.mamoe.mirai.console.command.ConsoleCommandSender -import net.mamoe.mirai.console.util.ConsoleInternalAPI +import net.mamoe.mirai.console.util.ConsoleInternalApi import net.mamoe.mirai.console.util.requestInput import net.mamoe.mirai.utils.DefaultLogger import org.jline.reader.UserInterruptException val consoleLogger by lazy { DefaultLogger("console") } -@OptIn(ConsoleInternalAPI::class) +@OptIn(ConsoleInternalApi::class) internal fun startupConsoleThread() { MiraiConsole.launch(CoroutineName("Input")) { while (true) { diff --git a/frontend/mirai-console-pure/src/main/kotlin/net/mamoe/mirai/console/pure/MiraiConsoleImplementationPure.kt b/frontend/mirai-console-pure/src/main/kotlin/net/mamoe/mirai/console/pure/MiraiConsoleImplementationPure.kt index 9bdf2d2ce..97ca52f17 100644 --- a/frontend/mirai-console-pure/src/main/kotlin/net/mamoe/mirai/console/pure/MiraiConsoleImplementationPure.kt +++ b/frontend/mirai-console-pure/src/main/kotlin/net/mamoe/mirai/console/pure/MiraiConsoleImplementationPure.kt @@ -17,7 +17,7 @@ "INVISIBLE_ABSTRACT_MEMBER_FROM_SUPER_WARNING", "EXPOSED_SUPER_CLASS" ) -@file:OptIn(ConsoleInternalAPI::class, ConsoleFrontEndImplementation::class) +@file:OptIn(ConsoleInternalApi::class, ConsoleFrontEndImplementation::class) package net.mamoe.mirai.console.pure @@ -34,9 +34,9 @@ import net.mamoe.mirai.console.plugin.DeferredPluginLoader import net.mamoe.mirai.console.plugin.PluginLoader import net.mamoe.mirai.console.plugin.jvm.JarPluginLoader import net.mamoe.mirai.console.pure.ConsoleInputImpl.requestInput -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi import net.mamoe.mirai.console.util.ConsoleInput -import net.mamoe.mirai.console.util.ConsoleInternalAPI +import net.mamoe.mirai.console.util.ConsoleInternalApi import net.mamoe.mirai.console.util.NamedSupervisorJob import net.mamoe.mirai.utils.* import org.fusesource.jansi.Ansi @@ -58,7 +58,7 @@ import java.util.* * * @see MiraiConsolePureLoader CLI 入口点 */ -@ConsoleExperimentalAPI +@ConsoleExperimentalApi class MiraiConsoleImplementationPure @JvmOverloads constructor( override val rootPath: Path = Paths.get("."), diff --git a/frontend/mirai-console-pure/src/main/kotlin/net/mamoe/mirai/console/pure/MiraiConsolePureLoader.kt b/frontend/mirai-console-pure/src/main/kotlin/net/mamoe/mirai/console/pure/MiraiConsolePureLoader.kt index e52a0ef7e..e1bc7d3f2 100644 --- a/frontend/mirai-console-pure/src/main/kotlin/net/mamoe/mirai/console/pure/MiraiConsolePureLoader.kt +++ b/frontend/mirai-console-pure/src/main/kotlin/net/mamoe/mirai/console/pure/MiraiConsolePureLoader.kt @@ -15,7 +15,7 @@ "INVISIBLE_GETTER", "INVISIBLE_ABSTRACT_MEMBER_FROM_SUPER", ) -@file:OptIn(ConsoleInternalAPI::class) +@file:OptIn(ConsoleInternalApi::class) package net.mamoe.mirai.console.pure @@ -26,8 +26,8 @@ import net.mamoe.mirai.console.MiraiConsole import net.mamoe.mirai.console.MiraiConsoleImplementation import net.mamoe.mirai.console.MiraiConsoleImplementation.Companion.start import net.mamoe.mirai.console.data.AutoSavePluginDataHolder -import net.mamoe.mirai.console.util.ConsoleExperimentalAPI -import net.mamoe.mirai.console.util.ConsoleInternalAPI +import net.mamoe.mirai.console.util.ConsoleExperimentalApi +import net.mamoe.mirai.console.util.ConsoleInternalApi import net.mamoe.mirai.console.util.CoroutineScopeUtils.childScope import net.mamoe.mirai.message.data.Message import net.mamoe.mirai.utils.DefaultLogger @@ -51,7 +51,7 @@ object MiraiConsolePureLoader { } @Suppress("MemberVisibilityCanBePrivate") - @ConsoleExperimentalAPI + @ConsoleExperimentalApi fun startAsDaemon(instance: MiraiConsoleImplementationPure = MiraiConsoleImplementationPure()) { instance.start() overrideSTD() @@ -61,10 +61,10 @@ object MiraiConsolePureLoader { internal object ConsoleDataHolder : AutoSavePluginDataHolder, CoroutineScope by MiraiConsole.childScope("ConsoleDataHolder") { - @ConsoleExperimentalAPI + @ConsoleExperimentalApi override val autoSaveIntervalMillis: LongRange = 1.minutesToMillis..10.minutesToMillis - @ConsoleExperimentalAPI + @ConsoleExperimentalApi override val dataHolderName: String get() = "Pure" }