From 0acc99ed422e9542bf5ac8f2b195cd2072a17811 Mon Sep 17 00:00:00 2001 From: Him188 Date: Mon, 31 Aug 2020 19:25:34 +0800 Subject: [PATCH] Optimize code --- .../mirai/console/internal/plugin/JarPluginLoaderImpl.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/plugin/JarPluginLoaderImpl.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/plugin/JarPluginLoaderImpl.kt index 333e6009a..1a840b648 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/plugin/JarPluginLoaderImpl.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/plugin/JarPluginLoaderImpl.kt @@ -32,7 +32,9 @@ import java.net.URLClassLoader internal object JarPluginLoaderImpl : AbstractFilePluginLoader(".jar"), - CoroutineScope, + CoroutineScope by MiraiConsole.childScope("JarPluginLoader", CoroutineExceptionHandler { _, throwable -> + JarPluginLoaderImpl.logger.error("Unhandled Jar plugin exception: ${throwable.message}", throwable) + }), JarPluginLoader { override val configStorage: PluginDataStorage @@ -44,11 +46,6 @@ internal object JarPluginLoaderImpl : override val dataStorage: PluginDataStorage get() = MiraiConsoleImplementationBridge.dataStorageForJarPluginLoader - override val coroutineContext: CoroutineContext = - MiraiConsole.childScopeContext("JarPluginLoader", CoroutineExceptionHandler { _, throwable -> - logger.error("Unhandled Jar plugin exception: ${throwable.message}", throwable) - }) - internal val classLoaders: MutableList = mutableListOf() @Suppress("EXTENSION_SHADOWED_BY_MEMBER") // doesn't matter