From 662013e4eced9ac3a1ac8a3c9a68ef8ee7d17ac2 Mon Sep 17 00:00:00 2001 From: Him188 Date: Thu, 8 Apr 2021 12:43:19 +0800 Subject: [PATCH] Fix build and fix warnings --- .../src/internal/data/MultiFilePluginDataStorageImpl.kt | 4 ++-- backend/mirai-console/src/internal/util/CommonUtils.kt | 2 +- backend/mirai-console/src/plugin/jvm/JvmPluginDescription.kt | 2 +- backend/mirai-console/test/command/TestCommand.kt | 2 +- .../src/diagnostics/fix/WrapWithResourceUseCallIntention.kt | 2 +- tools/intellij-plugin/src/resolve/resolveIdea.kt | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/mirai-console/src/internal/data/MultiFilePluginDataStorageImpl.kt b/backend/mirai-console/src/internal/data/MultiFilePluginDataStorageImpl.kt index 0144c256e..1e1f34d39 100644 --- a/backend/mirai-console/src/internal/data/MultiFilePluginDataStorageImpl.kt +++ b/backend/mirai-console/src/internal/data/MultiFilePluginDataStorageImpl.kt @@ -36,7 +36,7 @@ internal open class MultiFilePluginDataStorageImpl( val text = getPluginDataFile(holder, instance).readText() if (text.isNotBlank()) { logger.warning { "Deserializing $text" } - Yaml.default.decodeFromString(instance.updaterSerializer, text) + Yaml.decodeFromString(instance.updaterSerializer, text) } else { this.store(holder, instance) // save an initial copy } @@ -68,7 +68,7 @@ internal open class MultiFilePluginDataStorageImpl( encodeDefaults = true } - private val yaml = Yaml.default + private val yaml = Yaml @ConsoleExperimentalApi public override fun store(holder: PluginDataHolder, instance: PluginData) { diff --git a/backend/mirai-console/src/internal/util/CommonUtils.kt b/backend/mirai-console/src/internal/util/CommonUtils.kt index 74d031a62..9605c6b26 100644 --- a/backend/mirai-console/src/internal/util/CommonUtils.kt +++ b/backend/mirai-console/src/internal/util/CommonUtils.kt @@ -48,7 +48,7 @@ internal inline fun T?.ifNull(block: () -> T): T { return this ?: block() } -@Suppress("DeprecatedCallableAddReplaceWith", "UnusedParameter") +@Suppress("DeprecatedCallableAddReplaceWith", "UnusedParameter", "UNUSED_PARAMETER") @Deprecated("Useless ifNull on not null value.") @JvmName("ifNull1") internal inline fun T.ifNull(block: () -> T): T = this diff --git a/backend/mirai-console/src/plugin/jvm/JvmPluginDescription.kt b/backend/mirai-console/src/plugin/jvm/JvmPluginDescription.kt index 204431cb1..f338838e1 100644 --- a/backend/mirai-console/src/plugin/jvm/JvmPluginDescription.kt +++ b/backend/mirai-console/src/plugin/jvm/JvmPluginDescription.kt @@ -52,7 +52,7 @@ public interface JvmPluginDescription : PluginDescription { val bytes = stream.use { it.readBytes() } - return Yaml.default.decodeFromString(SimpleJvmPluginDescription.SerialData.serializer(), String(bytes)).toJvmPluginDescription() + return Yaml.decodeFromString(SimpleJvmPluginDescription.SerialData.serializer(), String(bytes)).toJvmPluginDescription() } } } diff --git a/backend/mirai-console/test/command/TestCommand.kt b/backend/mirai-console/test/command/TestCommand.kt index beee000aa..7d2befb74 100644 --- a/backend/mirai-console/test/command/TestCommand.kt +++ b/backend/mirai-console/test/command/TestCommand.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -@file:Suppress("unused") +@file:Suppress("unused", "UNUSED_PARAMETER") package net.mamoe.mirai.console.command diff --git a/tools/intellij-plugin/src/diagnostics/fix/WrapWithResourceUseCallIntention.kt b/tools/intellij-plugin/src/diagnostics/fix/WrapWithResourceUseCallIntention.kt index 539d201db..889b77a79 100644 --- a/tools/intellij-plugin/src/diagnostics/fix/WrapWithResourceUseCallIntention.kt +++ b/tools/intellij-plugin/src/diagnostics/fix/WrapWithResourceUseCallIntention.kt @@ -62,5 +62,5 @@ class WrapWithResourceUseCallJavaIntention : SelfTargetingIntention yieldAll(superTypeListEntries) for (list in superTypeListEntries.asSequence()) { yieldAll( - (list.typeAsUserType?.referenceExpression?.resolve()?.parentsWithSelf?.filterIsInstance() + (list.typeAsUserType?.referenceExpression?.resolve()?.parents(true)?.filterIsInstance() ?.firstOrNull())?.allSuperTypes.orEmpty() ) }