Commit c5d98cbe authored by Him188's avatar Him188

Replace use of `Experimental` with `OptIn`

parent 710379eb
...@@ -32,7 +32,7 @@ actual constructor( ...@@ -32,7 +32,7 @@ actual constructor(
configuration: BotConfiguration configuration: BotConfiguration
) : QQAndroidBotBase(context, account, configuration) ) : QQAndroidBotBase(context, account, configuration)
@UseExperimental(MiraiInternalAPI::class) @OptIn(MiraiInternalAPI::class)
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
internal actual fun ByteReadChannel.toKotlinByteReadChannel(): kotlinx.coroutines.io.ByteReadChannel { internal actual fun ByteReadChannel.toKotlinByteReadChannel(): kotlinx.coroutines.io.ByteReadChannel {
return object : kotlinx.coroutines.io.ByteReadChannel { return object : kotlinx.coroutines.io.ByteReadChannel {
...@@ -144,7 +144,7 @@ internal actual fun ByteReadChannel.toKotlinByteReadChannel(): kotlinx.coroutine ...@@ -144,7 +144,7 @@ internal actual fun ByteReadChannel.toKotlinByteReadChannel(): kotlinx.coroutine
return this@toKotlinByteReadChannel.readRemaining(limit, headerSizeHint).readBytes().toReadPacket() return this@toKotlinByteReadChannel.readRemaining(limit, headerSizeHint).readBytes().toReadPacket()
} }
@UseExperimental(ExperimentalIoApi::class) @OptIn(ExperimentalIoApi::class)
@ExperimentalIoApi @ExperimentalIoApi
override fun readSession(consumer: ReadSession.() -> Unit) { override fun readSession(consumer: ReadSession.() -> Unit) {
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
......
...@@ -227,5 +227,5 @@ internal abstract class QQAndroidBotBase constructor( ...@@ -227,5 +227,5 @@ internal abstract class QQAndroidBotBase constructor(
} }
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
@UseExperimental(MiraiInternalAPI::class) @OptIn(MiraiInternalAPI::class)
internal expect fun io.ktor.utils.io.ByteReadChannel.toKotlinByteReadChannel(): ByteReadChannel internal expect fun io.ktor.utils.io.ByteReadChannel.toKotlinByteReadChannel(): ByteReadChannel
\ No newline at end of file
...@@ -37,7 +37,7 @@ internal actual class QQAndroidBot actual constructor( ...@@ -37,7 +37,7 @@ internal actual class QQAndroidBot actual constructor(
configuration: BotConfiguration configuration: BotConfiguration
) : QQAndroidBotBase(context, account, configuration) ) : QQAndroidBotBase(context, account, configuration)
@UseExperimental(MiraiInternalAPI::class) @OptIn(MiraiInternalAPI::class)
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
internal actual fun ByteReadChannel.toKotlinByteReadChannel(): kotlinx.coroutines.io.ByteReadChannel { internal actual fun ByteReadChannel.toKotlinByteReadChannel(): kotlinx.coroutines.io.ByteReadChannel {
return object : kotlinx.coroutines.io.ByteReadChannel { return object : kotlinx.coroutines.io.ByteReadChannel {
...@@ -145,7 +145,7 @@ internal actual fun ByteReadChannel.toKotlinByteReadChannel(): kotlinx.coroutine ...@@ -145,7 +145,7 @@ internal actual fun ByteReadChannel.toKotlinByteReadChannel(): kotlinx.coroutine
return this@toKotlinByteReadChannel.readRemaining(limit, headerSizeHint).readBytes().toReadPacket() return this@toKotlinByteReadChannel.readRemaining(limit, headerSizeHint).readBytes().toReadPacket()
} }
@UseExperimental(ExperimentalIoApi::class) @OptIn(ExperimentalIoApi::class)
@ExperimentalIoApi @ExperimentalIoApi
override fun readSession(consumer: ReadSession.() -> Unit) { override fun readSession(consumer: ReadSession.() -> Unit) {
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
......
...@@ -40,7 +40,7 @@ abstract class BotImpl<N : BotNetworkHandler> constructor( ...@@ -40,7 +40,7 @@ abstract class BotImpl<N : BotNetworkHandler> constructor(
?: CoroutineExceptionHandler { _, e -> logger.error("An exception was thrown under a coroutine of Bot", e) }) ?: CoroutineExceptionHandler { _, e -> logger.error("An exception was thrown under a coroutine of Bot", e) })
override val context: Context by context.unsafeWeakRef() override val context: Context by context.unsafeWeakRef()
@UseExperimental(LowLevelAPI::class) @OptIn(LowLevelAPI::class)
@Suppress("CanBePrimaryConstructorProperty", "OverridingDeprecatedMember") // for logger @Suppress("CanBePrimaryConstructorProperty", "OverridingDeprecatedMember") // for logger
final override val account: BotAccount = account final override val account: BotAccount = account
......
...@@ -15,7 +15,7 @@ import net.mamoe.mirai.utils.MiraiInternalAPI ...@@ -15,7 +15,7 @@ import net.mamoe.mirai.utils.MiraiInternalAPI
* 表明这个 API 是为了让 Java 使用者调用更方便. * 表明这个 API 是为了让 Java 使用者调用更方便.
*/ */
@MiraiInternalAPI @MiraiInternalAPI
@Experimental(level = Experimental.Level.ERROR) @RequiresOptIn(level = RequiresOptIn.Level.ERROR)
@Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS) @Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS)
annotation class JavaHappyAPI annotation class JavaHappyAPI
......
...@@ -58,7 +58,7 @@ suspend fun ByteReadChannel.copyTo(dst: Output) { ...@@ -58,7 +58,7 @@ suspend fun ByteReadChannel.copyTo(dst: Output) {
* 从接收者管道读取所有数据并写入 [dst]. 不会关闭 [dst] * 从接收者管道读取所有数据并写入 [dst]. 不会关闭 [dst]
*/ */
suspend fun ByteReadChannel.copyTo(dst: ByteWriteChannel) { suspend fun ByteReadChannel.copyTo(dst: ByteWriteChannel) {
@UseExperimental(MiraiInternalAPI::class) @OptIn(MiraiInternalAPI::class)
ByteArrayPool.useInstance { buffer -> ByteArrayPool.useInstance { buffer ->
var size: Int var size: Int
while (this.readAvailable(buffer).also { size = it } > 0) { while (this.readAvailable(buffer).also { size = it } > 0) {
...@@ -126,7 +126,7 @@ suspend fun ByteReadChannel.copyAndClose(dst: Output) { ...@@ -126,7 +126,7 @@ suspend fun ByteReadChannel.copyAndClose(dst: Output) {
suspend fun ByteReadChannel.copyAndClose(dst: ByteWriteChannel) { suspend fun ByteReadChannel.copyAndClose(dst: ByteWriteChannel) {
@Suppress("DuplicatedCode") @Suppress("DuplicatedCode")
try { try {
@UseExperimental(MiraiInternalAPI::class) @OptIn(MiraiInternalAPI::class)
ByteArrayPool.useInstance { buffer -> ByteArrayPool.useInstance { buffer ->
var size: Int var size: Int
while (this.readAvailable(buffer).also { size = it } > 0) { while (this.readAvailable(buffer).also { size = it } > 0) {
...@@ -145,7 +145,7 @@ suspend fun ByteReadChannel.copyAndClose(dst: ByteWriteChannel) { ...@@ -145,7 +145,7 @@ suspend fun ByteReadChannel.copyAndClose(dst: ByteWriteChannel) {
suspend fun ByteReadChannel.copyAndClose(dst: io.ktor.utils.io.ByteWriteChannel) { suspend fun ByteReadChannel.copyAndClose(dst: io.ktor.utils.io.ByteWriteChannel) {
@Suppress("DuplicatedCode") @Suppress("DuplicatedCode")
try { try {
@UseExperimental(MiraiInternalAPI::class) @OptIn(MiraiInternalAPI::class)
ByteArrayPool.useInstance { buffer -> ByteArrayPool.useInstance { buffer ->
var size: Int var size: Int
while (this.readAvailable(buffer).also { size = it } > 0) { while (this.readAvailable(buffer).also { size = it } > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment