Fix build and fix warnings

This commit is contained in:
Him188 2021-04-08 12:43:19 +08:00
parent b17e60cbc9
commit 662013e4ec
6 changed files with 8 additions and 8 deletions

View File

@ -36,7 +36,7 @@ internal open class MultiFilePluginDataStorageImpl(
val text = getPluginDataFile(holder, instance).readText() val text = getPluginDataFile(holder, instance).readText()
if (text.isNotBlank()) { if (text.isNotBlank()) {
logger.warning { "Deserializing $text" } logger.warning { "Deserializing $text" }
Yaml.default.decodeFromString(instance.updaterSerializer, text) Yaml.decodeFromString(instance.updaterSerializer, text)
} else { } else {
this.store(holder, instance) // save an initial copy this.store(holder, instance) // save an initial copy
} }
@ -68,7 +68,7 @@ internal open class MultiFilePluginDataStorageImpl(
encodeDefaults = true encodeDefaults = true
} }
private val yaml = Yaml.default private val yaml = Yaml
@ConsoleExperimentalApi @ConsoleExperimentalApi
public override fun store(holder: PluginDataHolder, instance: PluginData) { public override fun store(holder: PluginDataHolder, instance: PluginData) {

View File

@ -48,7 +48,7 @@ internal inline fun <T : Any> T?.ifNull(block: () -> T): T {
return this ?: block() return this ?: block()
} }
@Suppress("DeprecatedCallableAddReplaceWith", "UnusedParameter") @Suppress("DeprecatedCallableAddReplaceWith", "UnusedParameter", "UNUSED_PARAMETER")
@Deprecated("Useless ifNull on not null value.") @Deprecated("Useless ifNull on not null value.")
@JvmName("ifNull1") @JvmName("ifNull1")
internal inline fun <T : Any> T.ifNull(block: () -> T): T = this internal inline fun <T : Any> T.ifNull(block: () -> T): T = this

View File

@ -52,7 +52,7 @@ public interface JvmPluginDescription : PluginDescription {
val bytes = stream.use { it.readBytes() } 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()
} }
} }
} }

View File

@ -7,7 +7,7 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
@file:Suppress("unused") @file:Suppress("unused", "UNUSED_PARAMETER")
package net.mamoe.mirai.console.command package net.mamoe.mirai.console.command

View File

@ -62,5 +62,5 @@ class WrapWithResourceUseCallJavaIntention : SelfTargetingIntention<PsiMethodCal
} }
fun PsiElement.isJavaVersionAtLeast(version: JavaSdkVersion): Boolean { fun PsiElement.isJavaVersionAtLeast(version: JavaSdkVersion): Boolean {
return this.module?.getService(JavaVersionService::class.java)?.isAtLeast(this, JavaSdkVersion.JDK_1_9) == true return this.module?.getService(JavaVersionService::class.java)?.isAtLeast(this, version) == true
} }

View File

@ -11,7 +11,7 @@ package net.mamoe.mirai.console.intellij.resolve
import com.intellij.openapi.project.Project import com.intellij.openapi.project.Project
import com.intellij.psi.* import com.intellij.psi.*
import com.intellij.psi.util.parentsWithSelf import com.intellij.psi.util.parents
import net.mamoe.mirai.console.compiler.common.castOrNull import net.mamoe.mirai.console.compiler.common.castOrNull
import net.mamoe.mirai.console.compiler.common.resolve.* import net.mamoe.mirai.console.compiler.common.resolve.*
import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.*
@ -68,7 +68,7 @@ val KtPureClassOrObject.allSuperTypes: Sequence<KtSuperTypeListEntry>
yieldAll(superTypeListEntries) yieldAll(superTypeListEntries)
for (list in superTypeListEntries.asSequence()) { for (list in superTypeListEntries.asSequence()) {
yieldAll( yieldAll(
(list.typeAsUserType?.referenceExpression?.resolve()?.parentsWithSelf?.filterIsInstance<KtClass>() (list.typeAsUserType?.referenceExpression?.resolve()?.parents(true)?.filterIsInstance<KtClass>()
?.firstOrNull())?.allSuperTypes.orEmpty() ?.firstOrNull())?.allSuperTypes.orEmpty()
) )
} }