diff --git a/mirai-core-api/src/commonMain/kotlin/event/Event.kt b/mirai-core-api/src/commonMain/kotlin/event/Event.kt index 3fb164dbd..756b20ed3 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/Event.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/Event.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 Mamoe Technologies and contributors. + * Copyright 2019-2021 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. @@ -14,8 +14,8 @@ package net.mamoe.mirai.event import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock -import net.mamoe.mirai.JavaFriendlyAPI import net.mamoe.mirai.event.internal.broadcastInternal +import net.mamoe.mirai.utils.JavaFriendlyAPI import net.mamoe.mirai.utils.MiraiExperimentalApi import net.mamoe.mirai.utils.internal.runBlocking diff --git a/mirai-core-api/src/commonMain/kotlin/event/EventChannel.kt b/mirai-core-api/src/commonMain/kotlin/event/EventChannel.kt index a7f471896..6fe6212b7 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/EventChannel.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/EventChannel.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 Mamoe Technologies and contributors. + * Copyright 2019-2021 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. @@ -18,7 +18,6 @@ package net.mamoe.mirai.event import kotlinx.coroutines.* import kotlinx.coroutines.channels.Channel import net.mamoe.mirai.Bot -import net.mamoe.mirai.JavaFriendlyAPI import net.mamoe.mirai.event.Listener.ConcurrencyKind.CONCURRENT import net.mamoe.mirai.event.Listener.ConcurrencyKind.LOCKED import net.mamoe.mirai.event.events.BotEvent @@ -26,6 +25,7 @@ import net.mamoe.mirai.event.internal.GlobalEventListeners import net.mamoe.mirai.event.internal.Handler import net.mamoe.mirai.event.internal.ListenerRegistry import net.mamoe.mirai.event.internal.registerEventHandler +import net.mamoe.mirai.utils.JavaFriendlyAPI import net.mamoe.mirai.utils.MiraiExperimentalApi import net.mamoe.mirai.utils.MiraiLogger import java.util.function.Consumer diff --git a/mirai-core-api/src/commonMain/kotlin/javaFriendly.kt b/mirai-core-api/src/commonMain/kotlin/javaFriendly.kt deleted file mode 100644 index 60a71ec9e..000000000 --- a/mirai-core-api/src/commonMain/kotlin/javaFriendly.kt +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright 2019-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 - -/** - * 表明这个 API 是为了让 Java 使用者调用更方便. - * - * 一般有一定的性能损失, 且不能在 JVM/Android 以外平台使用. 不要在 Kotlin 调用它. - */ -@RequiresOptIn(level = RequiresOptIn.Level.ERROR) -@Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS) -internal annotation class JavaFriendlyAPI \ No newline at end of file diff --git a/mirai-core-api/src/commonMain/kotlin/utils/Annotations.kt b/mirai-core-api/src/commonMain/kotlin/utils/Annotations.kt index e646d4a76..979e97351 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/Annotations.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/Annotations.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 Mamoe Technologies and contributors. + * Copyright 2019-2021 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. @@ -60,3 +60,11 @@ internal annotation class PlannedRemoval(val version: String) internal annotation class EventListenerLikeJava +/** + * 表明这个 API 是为了让 Java 使用者调用更方便. + * + * 一般有一定的性能损失, 且不能在 JVM/Android 以外平台使用. 不要在 Kotlin 调用它. + */ +@RequiresOptIn(level = RequiresOptIn.Level.ERROR) +@Target(PROPERTY, FUNCTION, TYPE, CLASS) +internal annotation class JavaFriendlyAPI \ No newline at end of file diff --git a/mirai-core-api/src/jvmTest/kotlin/event/JvmMethodEventsTestJava.kt b/mirai-core-api/src/jvmTest/kotlin/event/JvmMethodEventsTestJava.kt index 1a708adc4..4ca44eab6 100644 --- a/mirai-core-api/src/jvmTest/kotlin/event/JvmMethodEventsTestJava.kt +++ b/mirai-core-api/src/jvmTest/kotlin/event/JvmMethodEventsTestJava.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 Mamoe Technologies and contributors. + * Copyright 2019-2021 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. @@ -9,7 +9,7 @@ package net.mamoe.mirai.event -import net.mamoe.mirai.JavaFriendlyAPI +import net.mamoe.mirai.utils.JavaFriendlyAPI import net.mamoe.mirai.utils.EventListenerLikeJava import org.junit.jupiter.api.Test import java.util.concurrent.atomic.AtomicInteger diff --git a/mirai-core-api/src/jvmTest/kotlin/event/SimpleListenerHostTestJava.kt b/mirai-core-api/src/jvmTest/kotlin/event/SimpleListenerHostTestJava.kt index c5cb20d16..338b82fac 100644 --- a/mirai-core-api/src/jvmTest/kotlin/event/SimpleListenerHostTestJava.kt +++ b/mirai-core-api/src/jvmTest/kotlin/event/SimpleListenerHostTestJava.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 Mamoe Technologies and contributors. + * Copyright 2019-2021 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. @@ -10,7 +10,7 @@ package net.mamoe.mirai.event import kotlinx.coroutines.CoroutineScope -import net.mamoe.mirai.JavaFriendlyAPI +import net.mamoe.mirai.utils.JavaFriendlyAPI import net.mamoe.mirai.utils.EventListenerLikeJava import org.junit.jupiter.api.Test import java.util.concurrent.atomic.AtomicBoolean diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushTransMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushTransMsg.kt index a2a7a403a..dea55ff20 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushTransMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushTransMsg.kt @@ -18,7 +18,6 @@ import kotlinx.io.core.ByteReadPacket import kotlinx.io.core.discardExact import kotlinx.io.core.readUByte import kotlinx.io.core.readUInt -import net.mamoe.mirai.JavaFriendlyAPI import net.mamoe.mirai.contact.MemberPermission import net.mamoe.mirai.event.events.* import net.mamoe.mirai.internal.QQAndroidBot diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt index e775a067f..79d9898c7 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt @@ -19,7 +19,6 @@ import kotlinx.coroutines.sync.withLock import kotlinx.io.core.* import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.JavaFriendlyAPI import net.mamoe.mirai.Mirai import net.mamoe.mirai.contact.* import net.mamoe.mirai.data.FriendInfoImpl