From 87373ef3bac03f352be2125a25057b9588b5b89f Mon Sep 17 00:00:00 2001 From: Him188 Date: Sat, 12 Sep 2020 21:13:55 +0800 Subject: [PATCH] Review extensions: Rename ScopedComponentStorage to PluginComponentStorage; Add more extensions for PluginComponentStorage; Misc improvements --- .../console/extension/ComponentStorage.kt | 64 ++++-------- .../mirai/console/extension/Extension.kt | 7 +- .../extension/PluginComponentStorage.kt | 98 +++++++++++++++++++ .../extensions/BotConfigurationAlterer.kt | 16 ++- .../extensions/PermissionServiceProvider.kt | 15 +++ .../extensions/PluginLoaderProvider.kt | 15 +++ .../extensions/PostStartupExtension.kt | 2 - .../extensions/SingletonExtensionSelector.kt | 2 - .../internal/plugin/JvmPluginInternal.kt | 6 +- .../permission/PermissionImplementation.kt | 2 +- .../console/permission/PermissionService.kt | 1 + .../mirai/console/plugin/jvm/JvmPlugin.kt | 10 +- .../mamoe/mirai/console/data/SettingTest.kt | 9 -- 13 files changed, 170 insertions(+), 77 deletions(-) create mode 100644 backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extension/PluginComponentStorage.kt diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extension/ComponentStorage.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extension/ComponentStorage.kt index 952e11e7e..f6e419474 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extension/ComponentStorage.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extension/ComponentStorage.kt @@ -1,24 +1,31 @@ -@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +/* + * Copyright 2020 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. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ package net.mamoe.mirai.console.extension -import net.mamoe.mirai.console.extensions.LazyPermissionServiceProviderImpl -import net.mamoe.mirai.console.extensions.PermissionServiceProvider import net.mamoe.mirai.console.extensions.SingletonExtensionSelector import net.mamoe.mirai.console.extensions.SingletonExtensionSelector.ExtensionPoint.selectSingleton import net.mamoe.mirai.console.internal.data.kClassQualifiedNameOrTip -import net.mamoe.mirai.console.permission.PermissionService import net.mamoe.mirai.console.plugin.Plugin +import net.mamoe.mirai.console.plugin.jvm.JvmPlugin +import net.mamoe.mirai.console.plugin.jvm.JvmPlugin.Companion.onLoad import net.mamoe.mirai.console.plugin.name import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.CopyOnWriteArraySet import kotlin.contracts.contract -import kotlin.internal.LowPriorityInOverloadResolution import kotlin.reflect.KClass -import kotlin.reflect.full.companionObjectInstance /** * 组件容器, 容纳 [Plugin] 注册的 [Extension]. + * + * @see Extension + * @see JvmPlugin.onLoad */ public interface ComponentStorage { public fun contribute( @@ -34,45 +41,6 @@ public interface ComponentStorage { ) } -@Suppress("EXPOSED_SUPER_CLASS") -public class ScopedComponentStorage( - @JvmField - internal val plugin: Plugin, -) : AbstractConcurrentComponentStorage() { - /** - * 注册一个扩展 - */ - public fun contribute( - extensionPoint: ExtensionPoint, - lazyInstance: () -> E, - ) { - contribute(extensionPoint, plugin, lazyInstance) - } - - /** - * 注册一个扩展 - */ - public inline fun contribute( - noinline lazyInstance: () -> E, - ) { - @Suppress("UNCHECKED_CAST") - (contribute( - (E::class.companionObjectInstance as? ExtensionPoint - ?: error("Companion object of ${E::class.qualifiedName} is not an ExtensionPoint")), - lazyInstance - )) - } - - /** - * 注册一个 [PermissionService] - */ - public fun contributePermissionService( - lazyInstance: () -> PermissionService<*>, - ) { - contribute(PermissionServiceProvider, plugin, LazyPermissionServiceProviderImpl(lazyInstance)) - } -} - internal object GlobalComponentStorage : AbstractConcurrentComponentStorage() internal interface ExtensionRegistry { @@ -120,7 +88,8 @@ internal abstract class AbstractConcurrentComponentStorage : ComponentStorage { return withExtensions { _ -> block() } } - @LowPriorityInOverloadResolution + @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") + @kotlin.internal.LowPriorityInOverloadResolution internal inline fun ExtensionPoint.withExtensions(block: T.(plugin: Plugin) -> Unit) { contract { callsInPlace(block) @@ -193,7 +162,8 @@ internal abstract class AbstractConcurrentComponentStorage : ComponentStorage { internal inline fun ExtensionPoint.useExtensions(block: (extension: T) -> Unit): Unit = withExtensions(block) - @LowPriorityInOverloadResolution + @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") + @kotlin.internal.LowPriorityInOverloadResolution internal inline fun ExtensionPoint.useExtensions(block: (extension: T, plugin: Plugin) -> Unit): Unit = withExtensions(block) 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 7cf54a405..9a83ef339 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,17 @@ 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 /** * 表示一个扩展. + * + * @see ComponentStorage */ -@ConsoleExperimentalApi public interface Extension /** * 增加一些函数 (方法)的扩展 */ -@ConsoleExperimentalApi public interface FunctionExtension : Extension /** @@ -34,7 +33,6 @@ public interface FunctionExtension : Extension * * @see PermissionServiceProvider */ -@ConsoleExperimentalApi public interface SingletonExtension : Extension { public val instance: T } @@ -44,7 +42,6 @@ public interface SingletonExtension : Extension { * * @see PluginLoaderProvider */ -@ConsoleExperimentalApi public interface InstanceExtension : Extension { public val instance: T } diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extension/PluginComponentStorage.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extension/PluginComponentStorage.kt new file mode 100644 index 000000000..32a51a6aa --- /dev/null +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extension/PluginComponentStorage.kt @@ -0,0 +1,98 @@ +/* + * Copyright 2020 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. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + +package net.mamoe.mirai.console.extension + +import net.mamoe.mirai.console.extensions.* +import net.mamoe.mirai.console.permission.PermissionService +import net.mamoe.mirai.console.plugin.Plugin +import net.mamoe.mirai.console.plugin.loader.PluginLoader +import kotlin.reflect.full.companionObjectInstance + +/** + * 添加一些扩展给 [Plugin] 的 [ComponentStorage]. + * + * 所有扩展都会以 'lazy' 形式注册, 由 Console 在不同的启动阶段分别初始化各类扩展. + */ +@Suppress("EXPOSED_SUPER_CLASS", "unused", "MemberVisibilityCanBePrivate") +public class PluginComponentStorage( + @JvmField + internal val plugin: Plugin, +) : AbstractConcurrentComponentStorage() { + /** + * 注册一个扩展 + */ + public fun contribute( + extensionPoint: ExtensionPoint, + lazyInstance: () -> E, + ): Unit = contribute(extensionPoint, plugin, lazyInstance) + + /** + * 注册一个扩展 + */ + public inline fun contribute( + noinline lazyInstance: () -> E, + ) { + @Suppress("UNCHECKED_CAST") + (contribute( + (E::class.companionObjectInstance as? ExtensionPoint + ?: error("Companion object of ${E::class.qualifiedName} is not an ExtensionPoint")), + lazyInstance + )) + } + + /////////////////////////////////////////////////////////////////////////// + // FunctionExtension + /////////////////////////////////////////////////////////////////////////// + + /** 注册一个 [SingletonExtensionSelector] */ + public fun contributeSingletonExtensionSelector(lazyInstance: () -> SingletonExtensionSelector): Unit = + contribute(SingletonExtensionSelector, plugin, lazyInstance) + + /** 注册一个 [BotConfigurationAlterer] */ + public fun contributeBotConfigurationAlterer(instance: BotConfigurationAlterer): Unit = + contribute(BotConfigurationAlterer, plugin, lazyInstance = { instance }) + + /** 注册一个 [PostStartupExtension] */ + public fun contributePostStartupExtension(instance: PostStartupExtension): Unit = + contribute(PostStartupExtension, plugin, lazyInstance = { instance }) + + /** 注册一个 [PostStartupExtension] */ + public fun runAfterStartup(block: () -> Unit): Unit = contributePostStartupExtension(block) + + /////////////////////////////////////////////////////////////////////////// + // InstanceExtensions & SingletonExtensions + /////////////////////////////////////////////////////////////////////////// + + /** 注册一个 [PermissionServiceProvider] */ + @OverloadResolutionByLambdaReturnType + public fun contributePermissionService( + lazyInstance: () -> PermissionService<*>, + ): Unit = contribute(PermissionServiceProvider, plugin, LazyPermissionServiceProviderImpl(lazyInstance)) + + /** 注册一个 [PermissionServiceProvider] */ + @JvmName("contributePermissionServiceProvider") + @OverloadResolutionByLambdaReturnType + public fun contributePermissionService( + lazyProvider: () -> PermissionServiceProvider, + ): Unit = contribute(PermissionServiceProvider, plugin, lazyProvider) + + ///////////////////////////////////// + + /** 注册一个 [PluginLoaderProvider] */ + @OverloadResolutionByLambdaReturnType + public fun contributePluginLoader(lazyInstance: () -> PluginLoader<*, *>): Unit = + contribute(PluginLoaderProvider, plugin, LazyPluginLoaderProviderImpl(lazyInstance)) + + /** 注册一个 [PluginLoaderProvider] */ + @JvmName("contributePluginLoaderProvider") + @OverloadResolutionByLambdaReturnType + public fun contributePluginLoader(lazyProvider: () -> PluginLoaderProvider): Unit = + contribute(PluginLoaderProvider, plugin, lazyProvider) +} \ No newline at end of file diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/BotConfigurationAlterer.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/BotConfigurationAlterer.kt index fd1c7c0dd..45ce4f680 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/BotConfigurationAlterer.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/BotConfigurationAlterer.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2020 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. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + @file:Suppress("unused") package net.mamoe.mirai.console.extensions @@ -12,16 +21,15 @@ import net.mamoe.mirai.utils.BotConfiguration * * @see MiraiConsole.addBot */ -public interface BotConfigurationAlterer : FunctionExtension { +public fun interface BotConfigurationAlterer : FunctionExtension { /** * 修改 [configuration], 返回修改完成的 [BotConfiguration] */ - @JvmDefault public fun alterConfiguration( botId: Long, - configuration: BotConfiguration - ): BotConfiguration = configuration + configuration: BotConfiguration, + ): BotConfiguration public companion object ExtensionPoint : AbstractExtensionPoint(BotConfigurationAlterer::class) diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/PermissionServiceProvider.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/PermissionServiceProvider.kt index 5db869bb8..0fa2b9f26 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/PermissionServiceProvider.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/PermissionServiceProvider.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2020 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. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.console.extensions import net.mamoe.mirai.console.extension.AbstractExtensionPoint @@ -16,8 +25,14 @@ public interface PermissionServiceProvider : SingletonExtension } +/** + * @see PermissionServiceProvider + */ public class PermissionServiceProviderImpl(override val instance: PermissionService<*>) : PermissionServiceProvider +/** + * @see PermissionServiceProvider + */ public class LazyPermissionServiceProviderImpl(initializer: () -> PermissionService<*>) : PermissionServiceProvider { override val instance: PermissionService<*> by lazy(initializer) } \ No newline at end of file diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/PluginLoaderProvider.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/PluginLoaderProvider.kt index 4e6d9c41d..5a8912130 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/PluginLoaderProvider.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/PluginLoaderProvider.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2020 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. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.console.extensions import net.mamoe.mirai.console.extension.AbstractExtensionPoint @@ -9,4 +18,10 @@ import net.mamoe.mirai.console.plugin.loader.PluginLoader */ public interface PluginLoaderProvider : InstanceExtension> { public companion object ExtensionPoint : AbstractExtensionPoint(PluginLoaderProvider::class) +} + +public class PluginLoaderProviderImpl(override val instance: PluginLoader<*, *>) : PluginLoaderProvider + +public class LazyPluginLoaderProviderImpl(initializer: () -> PluginLoader<*, *>) : PluginLoaderProvider { + override val instance: PluginLoader<*, *> by lazy(initializer) } \ No newline at end of file diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/PostStartupExtension.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/PostStartupExtension.kt index aca64ca2f..ee8a97f45 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/PostStartupExtension.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/PostStartupExtension.kt @@ -16,8 +16,6 @@ import net.mamoe.mirai.console.extension.FunctionExtension * 在 Console 启动完成后立即在主线程调用的扩展. 用于进行一些必要的延迟初始化. * * 这些扩展只会, 且一定会被调用正好一次. - * - * 此扩展可由所有插件提供 */ public fun interface PostStartupExtension : FunctionExtension { /** 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 da4bb2261..60c2a4ce8 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,6 @@ 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.utils.info import kotlin.reflect.KClass @@ -23,7 +22,6 @@ import kotlin.reflect.KClass * * 如有多个 [SingletonExtensionSelector] 注册, 将会停止服务器. */ -@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/plugin/JvmPluginInternal.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/plugin/JvmPluginInternal.kt index fdba5b38e..26e3d6ed2 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/plugin/JvmPluginInternal.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/plugin/JvmPluginInternal.kt @@ -14,7 +14,7 @@ import kotlinx.atomicfu.locks.withLock import kotlinx.coroutines.* import net.mamoe.mirai.console.MiraiConsole import net.mamoe.mirai.console.data.runCatchingLog -import net.mamoe.mirai.console.extension.ScopedComponentStorage +import net.mamoe.mirai.console.extension.PluginComponentStorage import net.mamoe.mirai.console.internal.data.mkdir import net.mamoe.mirai.console.permission.Permission import net.mamoe.mirai.console.permission.PermissionService @@ -46,7 +46,7 @@ internal abstract class JvmPluginInternal( ) : JvmPlugin, CoroutineScope { @Suppress("LeakingThis") - internal val componentStorage: ScopedComponentStorage = ScopedComponentStorage(this) + internal val componentStorage: PluginComponentStorage = PluginComponentStorage(this) final override val parentPermission: Permission by lazy { PermissionService.INSTANCE.register( @@ -104,7 +104,7 @@ internal abstract class JvmPluginInternal( } @Throws(Throwable::class) - internal fun internalOnLoad(componentStorage: ScopedComponentStorage) { + internal fun internalOnLoad(componentStorage: PluginComponentStorage) { onLoad(componentStorage) } diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/PermissionImplementation.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/PermissionImplementation.kt index ddedd80d7..c215e224d 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/PermissionImplementation.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/PermissionImplementation.kt @@ -12,7 +12,7 @@ package net.mamoe.mirai.console.permission import kotlin.annotation.AnnotationTarget.* /** - * 表示一个应该由 [权限服务][PermissionService] 实现的类. + * 表示一个应该由权限插件实现的类. * * 这样的类不能被用户手动实现或者继承, 也不能使用属性委托或者类委托, 或者其他任意改变实现类的手段. * 用户仅应该使用从 [PermissionService] 或其他途径获取这些对象, 而不能自行实现它们. diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/PermissionService.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/PermissionService.kt index 1c2afbb4f..ed014fa99 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/PermissionService.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/PermissionService.kt @@ -24,6 +24,7 @@ import kotlin.reflect.KClass * * [PermissionServiceProvider] */ +@PermissionImplementation public interface PermissionService

{ /** * [P] 的类型 diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/jvm/JvmPlugin.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/jvm/JvmPlugin.kt index c02f63864..c76c3ee6a 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/jvm/JvmPlugin.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/jvm/JvmPlugin.kt @@ -18,7 +18,7 @@ package net.mamoe.mirai.console.plugin.jvm import kotlinx.coroutines.CoroutineScope -import net.mamoe.mirai.console.extension.ScopedComponentStorage +import net.mamoe.mirai.console.extension.PluginComponentStorage import net.mamoe.mirai.console.permission.PermissionIdNamespace import net.mamoe.mirai.console.plugin.Plugin import net.mamoe.mirai.console.plugin.PluginFileExtensions @@ -53,11 +53,13 @@ public interface JvmPlugin : Plugin, CoroutineScope, /** * 在插件被加载时调用. 只会被调用一次. * - * 在 [onLoad] 时可注册扩展 [ScopedComponentStorage.contribute] + * 在 [onLoad] 时可注册扩展 [PluginComponentStorage.contribute] + * + * @see PluginComponentStorage 查看更多信息 * * @receiver 组件容器 */ - public fun @ParameterName("storage") ScopedComponentStorage.onLoad() {} + public fun PluginComponentStorage.onLoad() {} /** * 在插件被启用时调用, 可能会被调用多次 @@ -71,6 +73,6 @@ public interface JvmPlugin : Plugin, CoroutineScope, public companion object { @JvmSynthetic - public inline fun JvmPlugin.onLoad(storage: ScopedComponentStorage): Unit = storage.onLoad() + public inline fun JvmPlugin.onLoad(storage: PluginComponentStorage): Unit = storage.onLoad() } } \ No newline at end of file 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 c8f6cde4f..22c052765 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 @@ -10,8 +10,6 @@ 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 org.junit.jupiter.api.Test import kotlin.test.assertEquals @@ -19,13 +17,6 @@ import kotlin.test.assertSame @OptIn(ConsoleInternalApi::class) internal class PluginDataTest { - - object MyPlugin : KotlinPlugin( - JvmPluginDescription( - "1", "2" - ) - ) - class MyPluginData : AutoSavePluginData() { var int by value(1) val map: MutableMap by value()