diff --git a/mirai-console/backend/mirai-console/compatibility-validation/jvm/api/jvm.api b/mirai-console/backend/mirai-console/compatibility-validation/jvm/api/jvm.api index 21c8809ab..e4258a090 100644 --- a/mirai-console/backend/mirai-console/compatibility-validation/jvm/api/jvm.api +++ b/mirai-console/backend/mirai-console/compatibility-validation/jvm/api/jvm.api @@ -1565,18 +1565,13 @@ public final class net/mamoe/mirai/console/extension/PluginComponentStorage { public fun (Lnet/mamoe/mirai/console/plugin/Plugin;)V public final fun contribute (Lnet/mamoe/mirai/console/extension/ExtensionPoint;Lkotlin/jvm/functions/Function0;)V public final fun contributeBotConfigurationAlterer (Lnet/mamoe/mirai/console/extensions/BotConfigurationAlterer;)V - public final fun contributeCommandCallInterceptor (Lkotlin/jvm/functions/Function0;)V public final fun contributeCommandCallInterceptorProvider (Lnet/mamoe/mirai/console/extensions/CommandCallInterceptorProvider;)V - public final fun contributeCommandCallParser (Lkotlin/jvm/functions/Function0;)V public final fun contributeCommandCallParserProvider (Lnet/mamoe/mirai/console/extensions/CommandCallParserProvider;)V - public final fun contributeCommandCallResolver (Lkotlin/jvm/functions/Function0;)V public final fun contributeCommandCallResolverProvider (Lnet/mamoe/mirai/console/extensions/CommandCallResolverProvider;)V - public final fun contributePermissionService (Lkotlin/jvm/functions/Function0;)V public final fun contributePermissionServiceProvider (Lkotlin/jvm/functions/Function0;)V - public final fun contributePluginLoader (Lkotlin/jvm/functions/Function0;)V public final fun contributePluginLoaderProvider (Lkotlin/jvm/functions/Function0;)V public final fun contributePostStartupExtension (Lnet/mamoe/mirai/console/extensions/PostStartupExtension;)V - public final fun contributeSingletonExtensionSelector (Lkotlin/jvm/functions/Function0;)V + public final synthetic fun contributeSingletonExtensionSelector (Lkotlin/jvm/functions/Function0;)V public final fun runAfterStartup (Lkotlin/jvm/functions/Function0;)V } @@ -1602,18 +1597,6 @@ public abstract interface class net/mamoe/mirai/console/extensions/CommandCallIn public final class net/mamoe/mirai/console/extensions/CommandCallInterceptorProvider$ExtensionPoint : net/mamoe/mirai/console/extension/AbstractInstanceExtensionPoint { } -public final class net/mamoe/mirai/console/extensions/CommandCallInterceptorProviderImpl : net/mamoe/mirai/console/extensions/CommandCallInterceptorProvider { - public fun (Lnet/mamoe/mirai/console/command/resolve/CommandCallInterceptor;)V - public synthetic fun getInstance ()Ljava/lang/Object; - public fun getInstance ()Lnet/mamoe/mirai/console/command/resolve/CommandCallInterceptor; -} - -public final class net/mamoe/mirai/console/extensions/CommandCallInterceptorProviderImplLazy : net/mamoe/mirai/console/extensions/CommandCallInterceptorProvider { - public fun (Lkotlin/jvm/functions/Function0;)V - public synthetic fun getInstance ()Ljava/lang/Object; - public fun getInstance ()Lnet/mamoe/mirai/console/command/resolve/CommandCallInterceptor; -} - public abstract interface class net/mamoe/mirai/console/extensions/CommandCallParserProvider : net/mamoe/mirai/console/extension/InstanceExtension { public static final field ExtensionPoint Lnet/mamoe/mirai/console/extensions/CommandCallParserProvider$ExtensionPoint; } @@ -1621,18 +1604,6 @@ public abstract interface class net/mamoe/mirai/console/extensions/CommandCallPa public final class net/mamoe/mirai/console/extensions/CommandCallParserProvider$ExtensionPoint : net/mamoe/mirai/console/extension/AbstractInstanceExtensionPoint { } -public final class net/mamoe/mirai/console/extensions/CommandCallParserProviderImpl : net/mamoe/mirai/console/extensions/CommandCallParserProvider { - public fun (Lnet/mamoe/mirai/console/command/parse/CommandCallParser;)V - public synthetic fun getInstance ()Ljava/lang/Object; - public fun getInstance ()Lnet/mamoe/mirai/console/command/parse/CommandCallParser; -} - -public final class net/mamoe/mirai/console/extensions/CommandCallParserProviderImplLazy : net/mamoe/mirai/console/extensions/CommandCallParserProvider { - public fun (Lkotlin/jvm/functions/Function0;)V - public synthetic fun getInstance ()Ljava/lang/Object; - public fun getInstance ()Lnet/mamoe/mirai/console/command/parse/CommandCallParser; -} - public abstract interface class net/mamoe/mirai/console/extensions/CommandCallResolverProvider : net/mamoe/mirai/console/extension/InstanceExtension { public static final field ExtensionPoint Lnet/mamoe/mirai/console/extensions/CommandCallResolverProvider$ExtensionPoint; } @@ -1640,18 +1611,6 @@ public abstract interface class net/mamoe/mirai/console/extensions/CommandCallRe public final class net/mamoe/mirai/console/extensions/CommandCallResolverProvider$ExtensionPoint : net/mamoe/mirai/console/extension/AbstractInstanceExtensionPoint { } -public final class net/mamoe/mirai/console/extensions/CommandCallResolverProviderImpl : net/mamoe/mirai/console/extensions/CommandCallResolverProvider { - public fun (Lnet/mamoe/mirai/console/command/resolve/CommandCallResolver;)V - public synthetic fun getInstance ()Ljava/lang/Object; - public fun getInstance ()Lnet/mamoe/mirai/console/command/resolve/CommandCallResolver; -} - -public final class net/mamoe/mirai/console/extensions/CommandCallResolverProviderImplLazy : net/mamoe/mirai/console/extensions/CommandCallResolverProvider { - public fun (Lkotlin/jvm/functions/Function0;)V - public synthetic fun getInstance ()Ljava/lang/Object; - public fun getInstance ()Lnet/mamoe/mirai/console/command/resolve/CommandCallResolver; -} - public abstract interface class net/mamoe/mirai/console/extensions/PermissionServiceProvider : net/mamoe/mirai/console/extension/InstanceExtension { public static final field ExtensionPoint Lnet/mamoe/mirai/console/extensions/PermissionServiceProvider$ExtensionPoint; } diff --git a/mirai-console/backend/mirai-console/src/MiraiConsole.kt b/mirai-console/backend/mirai-console/src/MiraiConsole.kt index 04efa73c9..daa4abf0a 100644 --- a/mirai-console/backend/mirai-console/src/MiraiConsole.kt +++ b/mirai-console/backend/mirai-console/src/MiraiConsole.kt @@ -132,13 +132,13 @@ public interface MiraiConsole : CoroutineScope { */ @Deprecated( "Please use the standard way in mirai-core to create loggers, i.e. MiraiLogger.Factory.INSTANCE.create()", - level = DeprecationLevel.WARNING, + level = DeprecationLevel.ERROR, replaceWith = ReplaceWith( "MiraiLogger.Factory.create(yourClass::class, identity)", "net.mamoe.mirai.utils.MiraiLogger" ), ) - @DeprecatedSinceMirai(warningSince = "2.13") + @DeprecatedSinceMirai(warningSince = "2.13", errorSince = "2.14") // for removal @ConsoleExperimentalApi public fun createLogger(identity: String?): MiraiLogger diff --git a/mirai-console/backend/mirai-console/src/MiraiConsoleImplementation.kt b/mirai-console/backend/mirai-console/src/MiraiConsoleImplementation.kt index f228658e2..8bbcac440 100644 --- a/mirai-console/backend/mirai-console/src/MiraiConsoleImplementation.kt +++ b/mirai-console/backend/mirai-console/src/MiraiConsoleImplementation.kt @@ -210,19 +210,6 @@ public interface MiraiConsoleImplementation : CoroutineScope { */ public fun createLoginSolver(requesterBot: Long, configuration: BotConfiguration): LoginSolver - /** - * 创建一个 [MiraiLogger]. - * - * **注意**: [MiraiConsole] 会将 [net.mamoe.mirai.utils.MiraiLogger.Factory] 设置为 `MiraiConsole::createLogger`. - * 因此不要在 [createLogger] 中调用 [net.mamoe.mirai.utils.MiraiLogger.create] - */ - @Deprecated( - "Deprecated for removal. Implement the other overload, or use MiraiConsole.createLogger instead.", - level = DeprecationLevel.ERROR - ) - @DeprecatedSinceMirai(errorSince = "2.13") - public fun createLogger(identity: String?): MiraiLogger - /** @see [MiraiConsole.newProcessProgress] */ public fun createNewProcessProgress(): ProcessProgress { return DefaultLoggingProcessProgress() diff --git a/mirai-console/backend/mirai-console/src/data/java/JAutoSavePluginConfig.kt b/mirai-console/backend/mirai-console/src/data/java/JAutoSavePluginConfig.kt index 1e05ac950..236ac99ee 100644 --- a/mirai-console/backend/mirai-console/src/data/java/JAutoSavePluginConfig.kt +++ b/mirai-console/backend/mirai-console/src/data/java/JAutoSavePluginConfig.kt @@ -41,8 +41,8 @@ import net.mamoe.mirai.utils.DeprecatedSinceMirai @Deprecated( "请使用 JavaAutoSavePluginConfig", replaceWith = ReplaceWith("JavaAutoSavePluginConfig", "net.mamoe.mirai.console.data.java.JavaAutoSavePluginConfig"), - level = DeprecationLevel.ERROR + level = DeprecationLevel.HIDDEN ) -@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") +@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14") public abstract class JAutoSavePluginConfig public constructor(saveName: String) : AutoSavePluginConfig(saveName), PluginConfig \ No newline at end of file diff --git a/mirai-console/backend/mirai-console/src/data/java/JAutoSavePluginData.kt b/mirai-console/backend/mirai-console/src/data/java/JAutoSavePluginData.kt index fa9564b4a..2653753e4 100644 --- a/mirai-console/backend/mirai-console/src/data/java/JAutoSavePluginData.kt +++ b/mirai-console/backend/mirai-console/src/data/java/JAutoSavePluginData.kt @@ -73,9 +73,9 @@ import kotlin.reflect.full.createType @Deprecated( "请使用 JavaAutoSavePluginData", replaceWith = ReplaceWith("JavaAutoSavePluginData", "net.mamoe.mirai.console.data.java.JavaAutoSavePluginData"), - level = DeprecationLevel.ERROR + level = DeprecationLevel.HIDDEN ) -@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") +@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14") public abstract class JAutoSavePluginData public constructor(saveName: String) : AutoSavePluginData(saveName), PluginConfig { diff --git a/mirai-console/backend/mirai-console/src/extension/Extension.kt b/mirai-console/backend/mirai-console/src/extension/Extension.kt index c57d8ddf5..d46d63780 100644 --- a/mirai-console/backend/mirai-console/src/extension/Extension.kt +++ b/mirai-console/backend/mirai-console/src/extension/Extension.kt @@ -66,9 +66,9 @@ public interface FunctionExtension : Extension @Deprecated( "Please use InstanceExtension instead.", replaceWith = ReplaceWith("InstanceExtension"), - level = DeprecationLevel.ERROR + level = DeprecationLevel.HIDDEN ) -@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") +@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14") public interface SingletonExtension : Extension { public val instance: T } diff --git a/mirai-console/backend/mirai-console/src/extension/ExtensionPoint.kt b/mirai-console/backend/mirai-console/src/extension/ExtensionPoint.kt index 9e8c862af..038c5abd2 100644 --- a/mirai-console/backend/mirai-console/src/extension/ExtensionPoint.kt +++ b/mirai-console/backend/mirai-console/src/extension/ExtensionPoint.kt @@ -42,9 +42,9 @@ public abstract class AbstractExtensionPoint( @Deprecated( "Please use InstanceExtensionPoint instead.", replaceWith = ReplaceWith("InstanceExtensionPoint"), - level = DeprecationLevel.ERROR + level = DeprecationLevel.HIDDEN ) -@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") +@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14") public interface SingletonExtensionPoint> : ExtensionPoint /** @@ -73,9 +73,9 @@ public constructor( "AbstractInstanceExtension", "net.mamoe.mirai.console.extension.AbstractInstanceExtensionPoint" ), - level = DeprecationLevel.ERROR + level = DeprecationLevel.HIDDEN ) -@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") +@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14") @Suppress("DEPRECATION", "DEPRECATION_ERROR") public abstract class AbstractSingletonExtensionPoint, T> /** diff --git a/mirai-console/backend/mirai-console/src/extension/PluginComponentStorage.kt b/mirai-console/backend/mirai-console/src/extension/PluginComponentStorage.kt index d90282662..865abf339 100644 --- a/mirai-console/backend/mirai-console/src/extension/PluginComponentStorage.kt +++ b/mirai-console/backend/mirai-console/src/extension/PluginComponentStorage.kt @@ -10,14 +10,9 @@ package net.mamoe.mirai.console.extension import net.mamoe.mirai.console.command.descriptor.ExperimentalCommandDescriptors -import net.mamoe.mirai.console.command.parse.CommandCallParser -import net.mamoe.mirai.console.command.resolve.CommandCallInterceptor -import net.mamoe.mirai.console.command.resolve.CommandCallResolver import net.mamoe.mirai.console.extensions.* import net.mamoe.mirai.console.internal.extension.AbstractConcurrentComponentStorage -import net.mamoe.mirai.console.permission.PermissionService import net.mamoe.mirai.console.plugin.Plugin -import net.mamoe.mirai.console.plugin.loader.PluginLoader import net.mamoe.mirai.utils.DeprecatedSinceMirai import kotlin.reflect.full.companionObjectInstance @@ -57,15 +52,15 @@ public class PluginComponentStorage( // FunctionExtension /////////////////////////////////////////////////////////////////////////// - /** 注册一个 [SingletonExtensionSelector] */ - @Suppress("DeprecatedCallableAddReplaceWith", "DEPRECATION_ERROR") + /** 注册一个 [net.mamoe.mirai.console.extensions.SingletonExtensionSelector] */ + @Suppress("DeprecatedCallableAddReplaceWith", "DEPRECATION_ERROR", "DEPRECATION") @Deprecated( "Order of extensions is now determined by its priority property since 2.11. SingletonExtensionSelector is not needed anymore. ", - level = DeprecationLevel.ERROR + level = DeprecationLevel.HIDDEN ) - @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") - public fun contributeSingletonExtensionSelector(lazyInstance: () -> SingletonExtensionSelector): Unit = - contribute(SingletonExtensionSelector, plugin, lazyInstance) + @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14") + public fun contributeSingletonExtensionSelector(lazyInstance: () -> net.mamoe.mirai.console.extensions.SingletonExtensionSelector): Unit = + contribute(net.mamoe.mirai.console.extensions.SingletonExtensionSelector.ExtensionPoint, plugin, lazyInstance) /** 注册一个 [BotConfigurationAlterer] */ public fun contributeBotConfigurationAlterer(instance: BotConfigurationAlterer): Unit = @@ -82,17 +77,6 @@ public class PluginComponentStorage( // InstanceExtensions & SingletonExtensions /////////////////////////////////////////////////////////////////////////// - /** 注册一个 [PermissionServiceProvider] */ - @Suppress("DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith") - @Deprecated( - "Deprecated for removal. Please implement your own CommandCallResolverProvider, and use contributePermissionService(provider).", - level = DeprecationLevel.ERROR - ) - @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal. - @OverloadResolutionByLambdaReturnType - public fun contributePermissionService(lazyInstance: () -> PermissionService<*>): Unit = - contribute(PermissionServiceProvider, plugin, PermissionServiceProviderImplLazy(lazyInstance)) - /** 注册一个 [PermissionServiceProvider] */ @JvmName("contributePermissionServiceProvider") @OverloadResolutionByLambdaReturnType @@ -101,17 +85,6 @@ public class PluginComponentStorage( ///////////////////////////////////// - /** 注册一个 [PluginLoaderProvider] */ - @Suppress("DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith") - @Deprecated( - "Deprecated for removal. Please implement your own CommandCallResolverProvider, and use contributePluginLoader(provider).", - level = DeprecationLevel.ERROR - ) - @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal. - @OverloadResolutionByLambdaReturnType - public fun contributePluginLoader(lazyInstance: () -> PluginLoader<*, *>): Unit = - contribute(PluginLoaderProvider, plugin, PluginLoaderProviderImplLazy(lazyInstance)) - /** 注册一个 [PluginLoaderProvider] */ @JvmName("contributePluginLoaderProvider") @OverloadResolutionByLambdaReturnType @@ -120,17 +93,6 @@ public class PluginComponentStorage( ///////////////////////////////////// - /** 注册一个 [CommandCallParserProvider] */ - @Suppress("DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith") - @Deprecated( - "Deprecated for removal. Please implement your own CommandCallResolverProvider, and use contributeCommandCallParser(provider).", - level = DeprecationLevel.ERROR - ) - @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal. - @ExperimentalCommandDescriptors - @OverloadResolutionByLambdaReturnType - public fun contributeCommandCallParser(lazyInstance: () -> CommandCallParser): Unit = - contribute(CommandCallParserProvider, plugin, CommandCallParserProviderImplLazy(lazyInstance)) /** 注册一个 [CommandCallParserProvider] */ @ExperimentalCommandDescriptors @@ -142,17 +104,6 @@ public class PluginComponentStorage( ///////////////////////////////////// - @Suppress("DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith") - @Deprecated( - "Deprecated for removal. Please implement your own CommandCallResolverProvider, and use contributeCommandCallResolver(provider).", - level = DeprecationLevel.ERROR - ) - @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal. - @ExperimentalCommandDescriptors - @OverloadResolutionByLambdaReturnType - public fun contributeCommandCallResolver(lazyInstance: () -> CommandCallResolver): Unit = - contribute(CommandCallResolverProvider, plugin, CommandCallResolverProviderImplLazy(lazyInstance)) - /** 注册一个 [CommandCallResolverProvider] */ @ExperimentalCommandDescriptors @JvmName("contributeCommandCallResolverProvider") @@ -162,18 +113,6 @@ public class PluginComponentStorage( ///////////////////////////////////// - /** 注册一个 [CommandCallInterceptorProvider] */ - @Suppress("DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith") - @Deprecated( - "Deprecated for removal. Please implement your own CommandCallResolverProvider, and use contributeCommandCallInterceptor(provider).", - level = DeprecationLevel.ERROR - ) - @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal. - @ExperimentalCommandDescriptors - @OverloadResolutionByLambdaReturnType - public fun contributeCommandCallInterceptor(lazyInstance: () -> CommandCallInterceptor): Unit = - contribute(CommandCallInterceptorProvider, plugin, CommandCallInterceptorProviderImplLazy(lazyInstance)) - /** 注册一个 [CommandCallInterceptorProvider] */ @ExperimentalCommandDescriptors @JvmName("contributeCommandCallInterceptorProvider") diff --git a/mirai-console/backend/mirai-console/src/extensions/CommandCallInterceptorProvider.kt b/mirai-console/backend/mirai-console/src/extensions/CommandCallInterceptorProvider.kt index d1b74e131..abccc5458 100644 --- a/mirai-console/backend/mirai-console/src/extensions/CommandCallInterceptorProvider.kt +++ b/mirai-console/backend/mirai-console/src/extensions/CommandCallInterceptorProvider.kt @@ -13,7 +13,6 @@ import net.mamoe.mirai.console.command.descriptor.ExperimentalCommandDescriptors import net.mamoe.mirai.console.command.resolve.CommandCallInterceptor import net.mamoe.mirai.console.extension.AbstractInstanceExtensionPoint import net.mamoe.mirai.console.extension.InstanceExtension -import net.mamoe.mirai.utils.DeprecatedSinceMirai @ExperimentalCommandDescriptors public interface CommandCallInterceptorProvider : InstanceExtension { @@ -22,24 +21,4 @@ public interface CommandCallInterceptorProvider : InstanceExtension( CommandCallInterceptorProvider::class ) -} - -@Deprecated( - "Deprecated for removal. Please implement your own CommandCallInterceptorProvider.", - level = DeprecationLevel.ERROR -) -@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal. -@ExperimentalCommandDescriptors -public class CommandCallInterceptorProviderImpl(override val instance: CommandCallInterceptor) : - CommandCallInterceptorProvider - -@Deprecated( - "Deprecated for removal. Please implement your own CommandCallInterceptorProvider.", - level = DeprecationLevel.ERROR -) -@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal. -@ExperimentalCommandDescriptors -public class CommandCallInterceptorProviderImplLazy(initializer: () -> CommandCallInterceptor) : - CommandCallInterceptorProvider { - override val instance: CommandCallInterceptor by lazy(initializer) } \ No newline at end of file diff --git a/mirai-console/backend/mirai-console/src/extensions/CommandCallParserProvider.kt b/mirai-console/backend/mirai-console/src/extensions/CommandCallParserProvider.kt index 8dd26ccdf..19512c151 100644 --- a/mirai-console/backend/mirai-console/src/extensions/CommandCallParserProvider.kt +++ b/mirai-console/backend/mirai-console/src/extensions/CommandCallParserProvider.kt @@ -13,7 +13,6 @@ import net.mamoe.mirai.console.command.descriptor.ExperimentalCommandDescriptors import net.mamoe.mirai.console.command.parse.CommandCallParser import net.mamoe.mirai.console.extension.AbstractInstanceExtensionPoint import net.mamoe.mirai.console.extension.InstanceExtension -import net.mamoe.mirai.utils.DeprecatedSinceMirai /** * The provider of [CommandCallParser] @@ -24,21 +23,3 @@ public interface CommandCallParserProvider : InstanceExtension(CommandCallParserProvider::class) } - -@Deprecated( - "Deprecated for removal. Please implement your own CommandCallParserProvider.", - level = DeprecationLevel.ERROR -) -@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal. -@ExperimentalCommandDescriptors -public class CommandCallParserProviderImpl(override val instance: CommandCallParser) : CommandCallParserProvider - -@Deprecated( - "Deprecated for removal. Please implement your own CommandCallParserProvider.", - level = DeprecationLevel.ERROR -) -@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal. -@ExperimentalCommandDescriptors -public class CommandCallParserProviderImplLazy(initializer: () -> CommandCallParser) : CommandCallParserProvider { - override val instance: CommandCallParser by lazy(initializer) -} \ No newline at end of file diff --git a/mirai-console/backend/mirai-console/src/extensions/CommandCallResolverProvider.kt b/mirai-console/backend/mirai-console/src/extensions/CommandCallResolverProvider.kt index 9b7541a1d..8cf92ed7b 100644 --- a/mirai-console/backend/mirai-console/src/extensions/CommandCallResolverProvider.kt +++ b/mirai-console/backend/mirai-console/src/extensions/CommandCallResolverProvider.kt @@ -13,7 +13,6 @@ import net.mamoe.mirai.console.command.descriptor.ExperimentalCommandDescriptors import net.mamoe.mirai.console.command.resolve.CommandCallResolver import net.mamoe.mirai.console.extension.AbstractInstanceExtensionPoint import net.mamoe.mirai.console.extension.InstanceExtension -import net.mamoe.mirai.utils.DeprecatedSinceMirai @ExperimentalCommandDescriptors public interface CommandCallResolverProvider : InstanceExtension { @@ -22,21 +21,3 @@ public interface CommandCallResolverProvider : InstanceExtension(CommandCallResolverProvider::class) } - -@Deprecated( - "Deprecated for removal. Please implement your own CommandCallResolverProvider.", - level = DeprecationLevel.ERROR -) -@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal. -@ExperimentalCommandDescriptors -public class CommandCallResolverProviderImpl(override val instance: CommandCallResolver) : CommandCallResolverProvider - -@Deprecated( - "Deprecated for removal. Please implement your own CommandCallResolverProvider.", - level = DeprecationLevel.ERROR -) -@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal. -@ExperimentalCommandDescriptors -public class CommandCallResolverProviderImplLazy(initializer: () -> CommandCallResolver) : CommandCallResolverProvider { - override val instance: CommandCallResolver by lazy(initializer) -} \ No newline at end of file diff --git a/mirai-console/backend/mirai-console/src/extensions/PermissionServiceProvider.kt b/mirai-console/backend/mirai-console/src/extensions/PermissionServiceProvider.kt index c54d1804c..dc9d77140 100644 --- a/mirai-console/backend/mirai-console/src/extensions/PermissionServiceProvider.kt +++ b/mirai-console/backend/mirai-console/src/extensions/PermissionServiceProvider.kt @@ -29,15 +29,15 @@ public interface PermissionServiceProvider : InstanceExtension) : PermissionServiceProvider /** * @see PermissionServiceProvider */ -@Deprecated("Please implement your own PermissionServiceProvider.", level = DeprecationLevel.ERROR) -@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for hidden. +@Deprecated("Please implement your own PermissionServiceProvider.", level = DeprecationLevel.HIDDEN) +@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14") // for hidden. public class PermissionServiceProviderImplLazy(initializer: () -> PermissionService<*>) : PermissionServiceProvider { override val instance: PermissionService<*> by lazy(initializer) } diff --git a/mirai-console/backend/mirai-console/src/extensions/PluginLoaderProvider.kt b/mirai-console/backend/mirai-console/src/extensions/PluginLoaderProvider.kt index 1cbe2fa85..b9acb8441 100644 --- a/mirai-console/backend/mirai-console/src/extensions/PluginLoaderProvider.kt +++ b/mirai-console/backend/mirai-console/src/extensions/PluginLoaderProvider.kt @@ -31,12 +31,12 @@ public interface PluginLoaderProvider : InstanceExtension> { public companion object ExtensionPoint : AbstractExtensionPoint(PluginLoaderProvider::class) } -@Deprecated("Please implement your own PluginLoaderProvider.", level = DeprecationLevel.ERROR) -@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for hidden. +@Deprecated("Please implement your own PluginLoaderProvider.", level = DeprecationLevel.HIDDEN) +@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14") // for hidden. public class PluginLoaderProviderImpl(override val instance: PluginLoader<*, *>) : PluginLoaderProvider -@Deprecated("Please implement your own PluginLoaderProvider.", level = DeprecationLevel.ERROR) -@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for hidden. +@Deprecated("Please implement your own PluginLoaderProvider.", level = DeprecationLevel.HIDDEN) +@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14") // for hidden. public class PluginLoaderProviderImplLazy(initializer: () -> PluginLoader<*, *>) : PluginLoaderProvider { override val instance: PluginLoader<*, *> by lazy(initializer) } \ No newline at end of file diff --git a/mirai-console/backend/mirai-console/src/extensions/SingletonExtensionSelector.kt b/mirai-console/backend/mirai-console/src/extensions/SingletonExtensionSelector.kt index d33ef2cf1..a4d854316 100644 --- a/mirai-console/backend/mirai-console/src/extensions/SingletonExtensionSelector.kt +++ b/mirai-console/backend/mirai-console/src/extensions/SingletonExtensionSelector.kt @@ -28,9 +28,9 @@ import kotlin.reflect.KClass */ @Deprecated( "Order of extensions is now determined by its priority property since 2.11. SingletonExtensionSelector is not needed anymore. ", - level = DeprecationLevel.ERROR + level = DeprecationLevel.HIDDEN ) -@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") +@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14") @Suppress("DEPRECATION_ERROR") public interface SingletonExtensionSelector : FunctionExtension { /** @@ -38,9 +38,9 @@ public interface SingletonExtensionSelector : FunctionExtension { */ @Deprecated( "Order of extensions is now determined by its priority property since 2.11. SingletonExtensionSelector is not needed anymore. ", - level = DeprecationLevel.ERROR + level = DeprecationLevel.HIDDEN ) - @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") + @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14") public data class Registry( val plugin: Plugin?, val extension: T, @@ -56,9 +56,9 @@ public interface SingletonExtensionSelector : FunctionExtension { @Deprecated( "Order of extensions is now determined by its priority property since 2.11. SingletonExtensionSelector is not needed anymore. ", - level = DeprecationLevel.ERROR + level = DeprecationLevel.HIDDEN ) - @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") + @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14") public companion object ExtensionPoint : AbstractExtensionPoint(SingletonExtensionSelector::class) { @@ -68,7 +68,7 @@ public interface SingletonExtensionSelector : FunctionExtension { internal fun init() { check(instanceField == null) { "Internal error: reinitialize SingletonExtensionSelector" } - val instances = GlobalComponentStorage.getExtensions(ExtensionPoint).toList() + val instances = GlobalComponentStorage.getExtensions(ExtensionPoint).toList() instanceField = when { instances.isEmpty() -> SingletonExtensionSelectorImpl instances.size == 1 -> { @@ -76,6 +76,7 @@ public interface SingletonExtensionSelector : FunctionExtension { MiraiConsole.mainLogger.info { "Loaded SingletonExtensionSelector: ${registry.extension} from ${registry.plugin?.name ?: ""}" } }.extension } + else -> { val hint = instances.joinToString { reg -> "'${reg.extension}' from '${reg.plugin?.name ?: ""}'" diff --git a/mirai-console/backend/mirai-console/src/internal/MiraiConsoleImplementationBridge.kt b/mirai-console/backend/mirai-console/src/internal/MiraiConsoleImplementationBridge.kt index 90f82f69e..2f14a0b27 100644 --- a/mirai-console/backend/mirai-console/src/internal/MiraiConsoleImplementationBridge.kt +++ b/mirai-console/backend/mirai-console/src/internal/MiraiConsoleImplementationBridge.kt @@ -160,7 +160,7 @@ internal class MiraiConsoleImplementationBridge( "MiraiLogger.Factory.create(yourClass::class, identity)", "net.mamoe.mirai.utils.MiraiLogger" ), - level = DeprecationLevel.WARNING + level = DeprecationLevel.ERROR ) override fun createLogger(identity: String?): MiraiLogger { return MiraiLogger.Factory.create(MiraiConsole::class, identity) diff --git a/mirai-console/backend/mirai-console/src/internal/extension/SingletonExtensionSelectorImpl.kt b/mirai-console/backend/mirai-console/src/internal/extension/SingletonExtensionSelectorImpl.kt index 306f05e59..f0ec4c956 100644 --- a/mirai-console/backend/mirai-console/src/internal/extension/SingletonExtensionSelectorImpl.kt +++ b/mirai-console/backend/mirai-console/src/internal/extension/SingletonExtensionSelectorImpl.kt @@ -26,9 +26,9 @@ import kotlin.reflect.KClass @Deprecated( "Order of extensions is not determined by its priority property since 2.11. SingletonExtensionSelector is not needed anymore. ", - level = DeprecationLevel.ERROR + level = DeprecationLevel.HIDDEN ) -@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") +@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14") internal object SingletonExtensionSelectorImpl : SingletonExtensionSelector { internal val config: SaveData = SaveData() diff --git a/mirai-console/backend/mirai-console/test/testFramework/MockConsoleImplementation.kt b/mirai-console/backend/mirai-console/test/testFramework/MockConsoleImplementation.kt index c8cc5a743..59d248135 100644 --- a/mirai-console/backend/mirai-console/test/testFramework/MockConsoleImplementation.kt +++ b/mirai-console/backend/mirai-console/test/testFramework/MockConsoleImplementation.kt @@ -79,7 +79,7 @@ open class MockConsoleImplementation : MiraiConsoleImplementation { @Suppress("DeprecatedCallableAddReplaceWith") @Deprecated( "Deprecated for removal. Implement the other overload, or use MiraiConsole.createLogger instead.", - level = DeprecationLevel.ERROR + level = DeprecationLevel.HIDDEN ) override fun createLogger(identity: String?): MiraiLogger { return PlatformLogger(identity) diff --git a/mirai-console/frontend/mirai-console-frontend-base/compatibility-validation/jvm/api/jvm.api b/mirai-console/frontend/mirai-console-frontend-base/compatibility-validation/jvm/api/jvm.api index fe24be49d..08a993d8a 100644 --- a/mirai-console/frontend/mirai-console-frontend-base/compatibility-validation/jvm/api/jvm.api +++ b/mirai-console/frontend/mirai-console-frontend-base/compatibility-validation/jvm/api/jvm.api @@ -1,6 +1,5 @@ public abstract class net/mamoe/mirai/console/frontendbase/AbstractMiraiConsoleFrontendImplementation : kotlinx/coroutines/CoroutineScope, net/mamoe/mirai/console/MiraiConsoleImplementation { public fun (Ljava/lang/String;)V - public fun createLogger (Ljava/lang/String;)Lnet/mamoe/mirai/utils/MiraiLogger; public fun createLoggerFactory (Lnet/mamoe/mirai/console/MiraiConsoleImplementation$FrontendLoggingInitContext;)Lnet/mamoe/mirai/utils/MiraiLogger$Factory; public fun getBuiltInPluginLoaders ()Ljava/util/List; public fun getCommandManager ()Lnet/mamoe/mirai/console/command/CommandManager; diff --git a/mirai-console/frontend/mirai-console-frontend-base/src/AbstractMiraiConsoleFrontendImplementation.kt b/mirai-console/frontend/mirai-console-frontend-base/src/AbstractMiraiConsoleFrontendImplementation.kt index 7d158c197..ceb0b3037 100644 --- a/mirai-console/frontend/mirai-console-frontend-base/src/AbstractMiraiConsoleFrontendImplementation.kt +++ b/mirai-console/frontend/mirai-console-frontend-base/src/AbstractMiraiConsoleFrontendImplementation.kt @@ -75,18 +75,6 @@ public abstract class AbstractMiraiConsoleFrontendImplementation( // region Logging - @Deprecated( - "Deprecated for removal. Implement the other overload, or use MiraiConsole.createLogger instead.", - level = DeprecationLevel.ERROR, - replaceWith = ReplaceWith( - "MiraiLogger.Factory.create(javaClass, identity)", - "net.mamoe.mirai.utils.MiraiLogger" - ) - ) - override fun createLogger(identity: String?): MiraiLogger { - return MiraiLogger.Factory.create(javaClass, identity) - } - override fun createLoggerFactory(context: MiraiConsoleImplementation.FrontendLoggingInitContext): MiraiLogger.Factory { @Suppress("INVISIBLE_MEMBER") frontendBase.initScreen_forwardStdToScreen() diff --git a/mirai-core-api/src/commonMain/kotlin/IMirai.kt b/mirai-core-api/src/commonMain/kotlin/IMirai.kt index 72e8e6ff2..ba3527990 100644 --- a/mirai-core-api/src/commonMain/kotlin/IMirai.kt +++ b/mirai-core-api/src/commonMain/kotlin/IMirai.kt @@ -90,16 +90,6 @@ public interface IMirai : LowLevelApiAccessor { */ public var FileCacheStrategy: FileCacheStrategy -// /** -// * Mirai 上传好友图片等使用的 Ktor [HttpClient]. -// * 默认使用 [OkHttp] 引擎, 连接超时为 30s. -// * -// * 覆盖后将会立即应用到全局. -// */ -// @Deprecated("Mirai is not going to use ktor. This is deprecated for removal.", level = DeprecationLevel.WARNING) -// @DeprecatedSinceMirai(warningSince = "2.11.0") -// public var Http: HttpClient - /** * 获取 uin. * diff --git a/mirai-core-api/src/commonMain/kotlin/event/events/group.kt b/mirai-core-api/src/commonMain/kotlin/event/events/group.kt index 4d89d93cd..e29442f39 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/events/group.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/events/group.kt @@ -20,6 +20,7 @@ import me.him188.kotlin.jvm.blocking.bridge.JvmBlockingBridge import net.mamoe.mirai.Bot import net.mamoe.mirai.Mirai import net.mamoe.mirai.contact.* +import net.mamoe.mirai.contact.announcement.Announcements import net.mamoe.mirai.data.GroupHonorType import net.mamoe.mirai.event.AbstractEvent import net.mamoe.mirai.event.BroadcastControllable @@ -189,9 +190,13 @@ public data class GroupNameChangeEvent @MiraiInternalApi constructor( /** * 入群公告改变. 此事件广播前修改就已经完成. + * + * ## 已弃用 + * + * 本事件不会再被触发. 无替代方法获知入群公告改变事件. 可使用 [Announcements] 主动获取所有公告列表. */ -@DeprecatedSinceMirai(warningSince = "2.12") -@Deprecated("This event is not being triggered anymore.", level = DeprecationLevel.WARNING) +@DeprecatedSinceMirai(warningSince = "2.12", errorSince = "2.14") +@Deprecated("This event is not being triggered anymore.", level = DeprecationLevel.ERROR) public data class GroupEntranceAnnouncementChangeEvent @MiraiInternalApi constructor( public override val origin: String, public override val new: String, diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/MessageChain.kt b/mirai-core-api/src/commonMain/kotlin/message/data/MessageChain.kt index d094013ab..2b92af3ed 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/MessageChain.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/MessageChain.kt @@ -374,18 +374,22 @@ public sealed interface MessageChain : * @since 2.12 */ // Java: MessageUtils.emptyMessageChain() -@Suppress("DEPRECATION") +@Suppress("DEPRECATION", "DEPRECATION_ERROR") public fun emptyMessageChain(): MessageChain = EmptyMessageChain /** - * 不含任何元素的 [MessageChain]. 已弃用, 请使用 [emptyMessageChain] + * 不含任何元素的 [MessageChain]. 已弃用, 请使用 [emptyMessageChain]. */ //@Serializable(MessageChain.Serializer::class) @Deprecated( "Please use emptyMessageChain()", - replaceWith = ReplaceWith("emptyMessageChain()", "net.mamoe.mirai.message.data.emptyMessageChain") + replaceWith = ReplaceWith("emptyMessageChain()", "net.mamoe.mirai.message.data.emptyMessageChain"), + level = DeprecationLevel.ERROR ) -@DeprecatedSinceMirai(warningSince = "2.12") +@DeprecatedSinceMirai( + warningSince = "2.12", + errorSince = "2.14" +) // make internal after deprecation cycle, but keep as @PublishedApi! @Suppress("EXPOSED_SUPER_CLASS") public object EmptyMessageChain : MessageChain, List by emptyList(), AbstractMessageChain(), DirectSizeAccess, DirectToStringAccess { diff --git a/mirai-core-api/src/jvmBaseMain/kotlin/event/EventChannel.kt b/mirai-core-api/src/jvmBaseMain/kotlin/event/EventChannel.kt index 86edd7dbd..893fbb95e 100644 --- a/mirai-core-api/src/jvmBaseMain/kotlin/event/EventChannel.kt +++ b/mirai-core-api/src/jvmBaseMain/kotlin/event/EventChannel.kt @@ -82,32 +82,6 @@ public actual abstract class EventChannel @MiraiInternalA */ public actual val defaultCoroutineContext: CoroutineContext, ) { - /** - * 创建事件监听并将监听结果发送在 [Channel]. 将返回值 [Channel] [关闭][Channel.close] 时将会同时关闭事件监听. - * - * @param capacity Channel 容量. 详见 [Channel] 构造. - * - * @see subscribeAlways - * @see Channel - */ - @Deprecated( - "Please use forwardToChannel instead.", - replaceWith = ReplaceWith( - "Channel(capacity).apply { forwardToChannel(this, coroutineContext, priority) }", - "kotlinx.coroutines.channels.Channel" - ), - level = DeprecationLevel.WARNING, - ) - @DeprecatedSinceMirai(warningSince = "2.10") - @MiraiExperimentalApi - public fun asChannel( - capacity: Int = Channel.RENDEZVOUS, - coroutineContext: CoroutineContext = EmptyCoroutineContext, - @Suppress("UNUSED_PARAMETER") concurrency: ConcurrencyKind = CONCURRENT, - priority: EventPriority = EventPriority.NORMAL, - ): Channel = - Channel(capacity).apply { forwardToChannel(this, coroutineContext, priority) } - /** * 创建事件监听并将监听结果转发到 [channel]. 当 [Channel.send] 抛出 [ClosedSendChannelException] 时停止 [Listener] 监听和转发. * @@ -684,6 +658,40 @@ public actual abstract class EventChannel @MiraiInternalA // endregion + // region deprecated + + /** + * 创建事件监听并将监听结果发送在 [Channel]. 将返回值 [Channel] [关闭][Channel.close] 时将会同时关闭事件监听. + * + * ## 已弃用 + * + * 请使用 [forwardToChannel] 替代. + * + * @param capacity Channel 容量. 详见 [Channel] 构造. + * + * @see subscribeAlways + * @see Channel + */ + @Deprecated( + "Please use forwardToChannel instead.", + replaceWith = ReplaceWith( + "Channel(capacity).apply { forwardToChannel(this, coroutineContext, priority) }", + "kotlinx.coroutines.channels.Channel" + ), + level = DeprecationLevel.ERROR, + ) + @DeprecatedSinceMirai(warningSince = "2.10", errorSince = "2.14") + @MiraiExperimentalApi + public fun asChannel( + capacity: Int = Channel.RENDEZVOUS, + coroutineContext: CoroutineContext = EmptyCoroutineContext, + @Suppress("UNUSED_PARAMETER") concurrency: ConcurrencyKind = CONCURRENT, + priority: EventPriority = EventPriority.NORMAL, + ): Channel = + Channel(capacity).apply { forwardToChannel(this, coroutineContext, priority) } + + // endregion + // region impl diff --git a/mirai-core-api/src/jvmBaseMain/kotlin/event/deprecated.syncFromEvent.kt b/mirai-core-api/src/jvmBaseMain/kotlin/event/deprecated.syncFromEvent.kt index 5743339ba..1c6a30491 100644 --- a/mirai-core-api/src/jvmBaseMain/kotlin/event/deprecated.syncFromEvent.kt +++ b/mirai-core-api/src/jvmBaseMain/kotlin/event/deprecated.syncFromEvent.kt @@ -203,8 +203,8 @@ public inline fun CoroutineScope.asyncFromEvent( //// internal ////////////// -@Deprecated("Deprecated since its usages are deprecated") -@DeprecatedSinceMirai(warningSince = "2.10") +@Deprecated("Deprecated since its usages are deprecated", level = DeprecationLevel.HIDDEN) +@DeprecatedSinceMirai(warningSince = "2.10", hiddenSince = "2.14") @JvmSynthetic @PublishedApi internal suspend inline fun syncFromEventImpl( diff --git a/mirai-core/src/commonMain/kotlin/contact/GroupSettingsImpl.kt b/mirai-core/src/commonMain/kotlin/contact/GroupSettingsImpl.kt index 7fc1dc797..e40649c97 100644 --- a/mirai-core/src/commonMain/kotlin/contact/GroupSettingsImpl.kt +++ b/mirai-core/src/commonMain/kotlin/contact/GroupSettingsImpl.kt @@ -35,14 +35,14 @@ internal class GroupSettingsImpl( getter: () -> T, setter: (T) -> Unit, crossinline packetConstructor: (client: QQAndroidClient, groupCode: Long, newValue: T) -> OutgoingPacket, - crossinline eventConstructor: (old: T) -> Event, + crossinline eventConstructor: (old: T) -> Event?, ) { checkBotPermission(MemberPermission.ADMINISTRATOR) val oldValue = getter() setter(newValue) launch { bot.network.sendWithoutExpect(packetConstructor(bot.client, id, newValue)) - eventConstructor(oldValue).broadcast() + eventConstructor(oldValue)?.broadcast() } } @@ -64,8 +64,7 @@ internal class GroupSettingsImpl( get() = _entranceAnnouncement set(newValue) { group.setImpl(newValue, { _entranceAnnouncement }, { _entranceAnnouncement = it }, GroupOperation::memo) { - @Suppress("DEPRECATION") - net.mamoe.mirai.event.events.GroupEntranceAnnouncementChangeEvent(it, newValue, group, null) + null } }