[build] Update to Kotlin 1.8.10

This commit is contained in:
Him188
2023-03-18 19:19:01 +00:00
parent 78d0b4fd54
commit 427c37e649
42 changed files with 125 additions and 267 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019-2022 Mamoe Technologies and contributors.
* Copyright 2019-2023 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.
@@ -62,6 +62,8 @@ dependencies {
smartImplementation(`maven-resolver-connector-basic`)
smartImplementation(`maven-resolver-transport-http`)
smartImplementation(`slf4j-api`)
smartImplementation(`kotlin-jvm-blocking-bridge`)
smartImplementation(`kotlin-dynamic-delegation`)
smartApi(`kotlinx-coroutines-jdk8`)
testApi(project(":mirai-core"))

View File

@@ -1860,7 +1860,6 @@ public final class net/mamoe/mirai/console/plugin/ResourceContainer$Companion {
public final class net/mamoe/mirai/console/plugin/center/PluginCenter$PluginInfo$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lnet/mamoe/mirai/console/plugin/center/PluginCenter$PluginInfo$$serializer;
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lnet/mamoe/mirai/console/plugin/center/PluginCenter$PluginInfo;
@@ -1876,7 +1875,6 @@ public final class net/mamoe/mirai/console/plugin/center/PluginCenter$PluginInfo
public final class net/mamoe/mirai/console/plugin/center/PluginCenter$PluginInsight$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lnet/mamoe/mirai/console/plugin/center/PluginCenter$PluginInsight$$serializer;
public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lnet/mamoe/mirai/console/plugin/center/PluginCenter$PluginInsight;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019-2022 Mamoe Technologies and contributors.
* Copyright 2019-2023 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.
@@ -78,7 +78,7 @@ public abstract class AbstractPluginData : PluginData, PluginDataImpl() {
public final override val updaterSerializer: KSerializer<Unit>
get() = super.updaterSerializer
public override val serializersModule: SerializersModule get() = EmptySerializersModule
public override val serializersModule: SerializersModule get() = EmptySerializersModule()
/**
* 当所属于这个 [PluginData] 的 [Value] 的 [值][Value.value] 被修改时被调用.
*/

View File

@@ -1,10 +1,10 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
* Copyright 2019-2023 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.
* 此源代码的使用受 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
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
@file:Suppress("DuplicatedCode")
@@ -128,15 +128,19 @@ internal open class ShadowMap<K, V, KR, VR>(
mappingFunction.apply(k.let(kTransform)).let(vTransformBack)
}.let(vTransform)
@Suppress("WRONG_TYPE_PARAMETER_NULLABILITY_FOR_JAVA_OVERRIDE")
override fun computeIfPresent(key: KR, remappingFunction: BiFunction<in KR, in VR, out VR?>): VR? =
originMapComputer().computeIfPresent(key.let(kTransformBack)) { k, v ->
remappingFunction.apply(k.let(kTransform), v.let(vTransform))?.let(vTransformBack)
}?.let(vTransform)
override fun merge(key: KR, value: VR, remappingFunction: BiFunction<in VR, in VR, out VR?>): VR? =
originMapComputer().merge(key.let(kTransformBack), value.let(vTransformBack)) { k, v ->
@Suppress("WRONG_TYPE_PARAMETER_NULLABILITY_FOR_JAVA_OVERRIDE")
override fun merge(key: KR, value: VR, remappingFunction: BiFunction<in VR, in VR, out VR?>): VR? {
@Suppress("NULLABLE_TYPE_PARAMETER_AGAINST_NOT_NULL_TYPE_PARAMETER")
return originMapComputer().merge(key.let(kTransformBack), value.let(vTransformBack)) { k, v ->
remappingFunction.apply(k.let(vTransform), v.let(vTransform))?.let(vTransformBack)
}?.let(vTransform)
}
override fun forEach(action: BiConsumer<in KR, in VR>) {
@Suppress("JavaMapForEach")
@@ -186,7 +190,9 @@ internal inline fun <E, R> MutableCollection<E>.shadowMap(
override fun remove(element: R): Boolean = this@shadowMap.removeIf { it.let(transform) == element }
override fun removeAll(elements: Collection<R>): Boolean = elements.all(::remove)
override fun retainAll(elements: Collection<R>): Boolean = this@shadowMap.retainAll(elements.map(transformBack))
override fun retainAll(elements: Collection<R>): Boolean =
this@shadowMap.retainAll(elements.mapTo(HashSet(elements.size), transformBack))
override fun toString(): String = this@shadowMap.toString()
override fun hashCode(): Int = this@shadowMap.hashCode()
}
@@ -293,7 +299,9 @@ internal inline fun <E, R> MutableSet<E>.shadowMap(
override fun remove(element: R): Boolean = this@shadowMap.removeIf { it.let(transform) == element }
override fun removeAll(elements: Collection<R>): Boolean = elements.all(::remove)
override fun retainAll(elements: Collection<R>): Boolean = this@shadowMap.retainAll(elements.map(transformBack))
override fun retainAll(elements: Collection<R>): Boolean =
this@shadowMap.retainAll(elements.mapTo(HashSet(elements.size), transformBack))
override fun toString(): String = this@shadowMap.toString()
override fun hashCode(): Int = this@shadowMap.hashCode()
}
@@ -384,7 +392,8 @@ internal inline fun <T> dynamicMutableSet(crossinline supplier: () -> MutableSet
"ACCIDENTAL_OVERRIDE", "TYPE_MISMATCH", "NOTHING_TO_OVERRIDE",
"MANY_IMPL_MEMBER_NOT_IMPLEMENTED", "MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED",
"UNCHECKED_CAST", "USELESS_CAST", "ACCIDENTAL_OVERRIDE",
"EXPLICIT_OVERRIDE_REQUIRED_IN_MIXED_MODE", "CONFLICTING_INHERITED_JVM_DECLARATIONS"
"EXPLICIT_OVERRIDE_REQUIRED_IN_MIXED_MODE", "CONFLICTING_INHERITED_JVM_DECLARATIONS",
"WRONG_TYPE_PARAMETER_NULLABILITY_FOR_JAVA_OVERRIDE", "NULLABLE_TYPE_PARAMETER_AGAINST_NOT_NULL_TYPE_PARAMETER"
) // type inference bug
internal fun <K, V> MutableMap<K, V>.observable(onChanged: () -> Unit): MutableMap<K, V> {
open class ObservableMap : MutableMap<K, V> by (this as MutableMap<K, V>) {
@@ -527,10 +536,10 @@ internal inline fun <T> MutableCollection<T>.observable(crossinline onChanged: (
override fun clear() = this@observable.clear().also { onChanged() }
override fun remove(element: T): Boolean = this@observable.remove(element).also { onChanged() }
override fun removeAll(elements: Collection<T>): Boolean =
this@observable.removeAll(elements).also { onChanged() }
this@observable.removeAll(elements.toSet()).also { onChanged() }
override fun retainAll(elements: Collection<T>): Boolean =
this@observable.retainAll(elements).also { onChanged() }
this@observable.retainAll(elements.toSet()).also { onChanged() }
override fun toString(): String = this@observable.toString()
override fun hashCode(): Int = this@observable.hashCode()
@@ -557,10 +566,10 @@ internal inline fun <T> MutableSet<T>.observable(crossinline onChanged: () -> Un
override fun clear() = this@observable.clear().also { onChanged() }
override fun remove(element: T): Boolean = this@observable.remove(element).also { onChanged() }
override fun removeAll(elements: Collection<T>): Boolean =
this@observable.removeAll(elements).also { onChanged() }
this@observable.removeAll(elements.toSet()).also { onChanged() }
override fun retainAll(elements: Collection<T>): Boolean =
this@observable.retainAll(elements).also { onChanged() }
this@observable.retainAll(elements.toSet()).also { onChanged() }
override fun toString(): String = this@observable.toString()
override fun hashCode(): Int = this@observable.hashCode()

View File

@@ -1,10 +1,10 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
* Copyright 2019-2023 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.
* 此源代码的使用受 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
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
import BinaryCompatibilityConfigurator.configureBinaryValidator
@@ -26,6 +26,7 @@ dependencies {
compileAndTestRuntime(project(":mirai-console"))
compileAndTestRuntime(project(":mirai-core-api"))
compileAndTestRuntime(project(":mirai-core-utils"))
compileAndTestRuntime(`kotlin-jvm-blocking-bridge`)
compileAndTestRuntime(`kotlin-stdlib-jdk8`)
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019-2022 Mamoe Technologies and contributors.
* Copyright 2019-2023 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.
@@ -24,6 +24,7 @@ dependencies {
shadowImplementation(jline)
shadowImplementation(jansi)
shadowImplementation(project(":mirai-console-frontend-base"))
implementation(`kotlin-jvm-blocking-bridge`)
testImplementation(project(":mirai-core"))
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019-2022 Mamoe Technologies and contributors.
* Copyright 2019-2023 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.
@@ -277,6 +277,7 @@ public open class BuildMiraiPluginV2 : Jar() {
duplicatesStrategy = DuplicatesStrategy.WARN
val compilations = target.compilations.filter { it.name == KotlinCompilation.MAIN_COMPILATION_NAME }
@Suppress("DEPRECATION") // New API requires Kotlin 1.8.0, but we must support lower versions
compilations.forEach {
dependsOn(it.compileKotlinTask)
from(it.output.allOutputs)

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019-2022 Mamoe Technologies and contributors.
* Copyright 2019-2023 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.
@@ -282,7 +282,7 @@ internal val Project.kotlinTargets: Collection<KotlinTarget>
return when (kotlinExtension) {
is KotlinMultiplatformExtension -> kotlinExtension.targets
is KotlinSingleTargetExtension -> listOf(kotlinExtension.target)
is KotlinSingleTargetExtension<*> -> listOf(kotlinExtension.target)
else -> error("[MiraiConsole] Internal error: kotlinExtension is neither KotlinMultiplatformExtension nor KotlinSingleTargetExtension")
}
}