diff --git a/build.gradle.kts b/build.gradle.kts index 042bf4cf0..a53b0fb23 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -231,7 +231,8 @@ val experimentalAnnotations = arrayOf( "kotlin.experimental.ExperimentalTypeInference", "net.mamoe.mirai.utils.MiraiInternalAPI", "net.mamoe.mirai.utils.MiraiExperimentalAPI", - "net.mamoe.mirai.LowLevelAPI" + "net.mamoe.mirai.LowLevelAPI", + "kotlinx.serialization.ExperimentalSerializationApi" ) fun Project.configureKotlinExperimentalUsages() { diff --git a/mirai-core-api/src/commonMain/kotlin/contact/Exceptions.kt b/mirai-core-api/src/commonMain/kotlin/contact/Exceptions.kt index 989462056..2388674c2 100644 --- a/mirai-core-api/src/commonMain/kotlin/contact/Exceptions.kt +++ b/mirai-core-api/src/commonMain/kotlin/contact/Exceptions.kt @@ -13,6 +13,7 @@ package net.mamoe.mirai.contact import net.mamoe.mirai.message.data.Message import net.mamoe.mirai.utils.asHumanReadable +import kotlin.time.ExperimentalTime import kotlin.time.seconds /** @@ -38,6 +39,7 @@ public class MessageTooLargeException( * * @see Group.sendMessage */ +@OptIn(ExperimentalTime::class) public class BotIsBeingMutedException( public val target: Group ) : RuntimeException("bot is being muted, remaining ${target.botMuteRemaining.seconds.asHumanReadable} seconds") diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/CustomMessage.kt b/mirai-core-api/src/commonMain/kotlin/message/data/CustomMessage.kt index fb416cecb..cd8856442 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/CustomMessage.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/CustomMessage.kt @@ -209,6 +209,7 @@ internal inline fun T.customToStringImpl(factory: Cu return (factory as CustomMessage.Factory).dump(this) } +@OptIn(ExperimentalUnsignedTypes::class) @JvmOverloads @Suppress("DuplicatedCode") // false positive. foreach is not common to UByteArray and ByteArray internal fun ByteArray.toUHexString( diff --git a/mirai-core-api/src/jvmTest/java/net/mamoe/mirai/event/JvmMethodEventsTestJava.java b/mirai-core-api/src/jvmTest/java/net/mamoe/mirai/event/JvmMethodEventsTestJava.java index 9f7e0a1e5..3cd8058fa 100644 --- a/mirai-core-api/src/jvmTest/java/net/mamoe/mirai/event/JvmMethodEventsTestJava.java +++ b/mirai-core-api/src/jvmTest/java/net/mamoe/mirai/event/JvmMethodEventsTestJava.java @@ -9,7 +9,7 @@ package net.mamoe.mirai.event; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.concurrent.atomic.AtomicInteger; diff --git a/mirai-core-api/src/jvmTest/kotlin/event/CancelScopeTest.kt b/mirai-core-api/src/jvmTest/kotlin/event/CancelScopeTest.kt index 949a59b19..05c97841c 100644 --- a/mirai-core-api/src/jvmTest/kotlin/event/CancelScopeTest.kt +++ b/mirai-core-api/src/jvmTest/kotlin/event/CancelScopeTest.kt @@ -11,7 +11,7 @@ package net.mamoe.mirai.event import kotlinx.coroutines.* import net.mamoe.mirai.event.broadcast import net.mamoe.mirai.event.subscribeAlways -import org.junit.Test +import org.junit.jupiter.api.Test import kotlin.test.assertFalse diff --git a/mirai-core-api/src/jvmTest/kotlin/event/JvmMethodEventsTest.kt b/mirai-core-api/src/jvmTest/kotlin/event/JvmMethodEventsTest.kt index d53a8cd24..30a917590 100644 --- a/mirai-core-api/src/jvmTest/kotlin/event/JvmMethodEventsTest.kt +++ b/mirai-core-api/src/jvmTest/kotlin/event/JvmMethodEventsTest.kt @@ -14,7 +14,7 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.runBlocking import net.mamoe.mirai.event.* import org.jetbrains.annotations.NotNull -import org.junit.Test +import org.junit.jupiter.api.Test import java.util.concurrent.atomic.AtomicInteger import kotlin.coroutines.EmptyCoroutineContext import kotlin.test.assertEquals diff --git a/mirai-core-api/src/jvmTest/kotlin/utils/LockFreeLinkedListTest.kt b/mirai-core-api/src/jvmTest/kotlin/utils/LockFreeLinkedListTest.kt index b6b4eb833..c60eea92e 100644 --- a/mirai-core-api/src/jvmTest/kotlin/utils/LockFreeLinkedListTest.kt +++ b/mirai-core-api/src/jvmTest/kotlin/utils/LockFreeLinkedListTest.kt @@ -145,6 +145,7 @@ internal class LockFreeLinkedListTest { list.size shouldBeEqualTo 0 } + @OptIn(ExperimentalUnsignedTypes::class) @Test fun withInlineClassElements() { val list = LockFreeLinkedList() diff --git a/mirai-core/src/jvmTest/java/SimpleListenerHostTest.java b/mirai-core/src/jvmTest/java/net/mamoe/mirai/javatest/SimpleListenerHostTest.java similarity index 71% rename from mirai-core/src/jvmTest/java/SimpleListenerHostTest.java rename to mirai-core/src/jvmTest/java/net/mamoe/mirai/javatest/SimpleListenerHostTest.java index 422e925ba..faf12d2b5 100644 --- a/mirai-core/src/jvmTest/java/SimpleListenerHostTest.java +++ b/mirai-core/src/jvmTest/java/net/mamoe/mirai/javatest/SimpleListenerHostTest.java @@ -1,9 +1,12 @@ /* - * Copyright 2020 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. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * * Copyright 2020 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. + * * + * * https://github.com/mamoe/mirai/blob/master/LICENSE + * */ package net.mamoe.mirai.javatest; @@ -12,7 +15,7 @@ import kotlin.coroutines.EmptyCoroutineContext; import kotlinx.coroutines.CoroutineScope; import kotlinx.coroutines.CoroutineScopeKt; import net.mamoe.mirai.event.*; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.concurrent.atomic.AtomicBoolean;