Replace use of Experimental with OptIn

This commit is contained in:
Him188 2020-03-08 00:44:43 +08:00
parent 710379eb80
commit c5d98cbefd
6 changed files with 10 additions and 10 deletions

View File

@ -32,7 +32,7 @@ actual constructor(
configuration: BotConfiguration
) : QQAndroidBotBase(context, account, configuration)
@UseExperimental(MiraiInternalAPI::class)
@OptIn(MiraiInternalAPI::class)
@Suppress("DEPRECATION")
internal actual fun ByteReadChannel.toKotlinByteReadChannel(): kotlinx.coroutines.io.ByteReadChannel {
return object : kotlinx.coroutines.io.ByteReadChannel {
@ -144,7 +144,7 @@ internal actual fun ByteReadChannel.toKotlinByteReadChannel(): kotlinx.coroutine
return this@toKotlinByteReadChannel.readRemaining(limit, headerSizeHint).readBytes().toReadPacket()
}
@UseExperimental(ExperimentalIoApi::class)
@OptIn(ExperimentalIoApi::class)
@ExperimentalIoApi
override fun readSession(consumer: ReadSession.() -> Unit) {
@Suppress("DEPRECATION")

View File

@ -227,5 +227,5 @@ internal abstract class QQAndroidBotBase constructor(
}
@Suppress("DEPRECATION")
@UseExperimental(MiraiInternalAPI::class)
@OptIn(MiraiInternalAPI::class)
internal expect fun io.ktor.utils.io.ByteReadChannel.toKotlinByteReadChannel(): ByteReadChannel

View File

@ -37,7 +37,7 @@ internal actual class QQAndroidBot actual constructor(
configuration: BotConfiguration
) : QQAndroidBotBase(context, account, configuration)
@UseExperimental(MiraiInternalAPI::class)
@OptIn(MiraiInternalAPI::class)
@Suppress("DEPRECATION")
internal actual fun ByteReadChannel.toKotlinByteReadChannel(): kotlinx.coroutines.io.ByteReadChannel {
return object : kotlinx.coroutines.io.ByteReadChannel {
@ -145,7 +145,7 @@ internal actual fun ByteReadChannel.toKotlinByteReadChannel(): kotlinx.coroutine
return this@toKotlinByteReadChannel.readRemaining(limit, headerSizeHint).readBytes().toReadPacket()
}
@UseExperimental(ExperimentalIoApi::class)
@OptIn(ExperimentalIoApi::class)
@ExperimentalIoApi
override fun readSession(consumer: ReadSession.() -> Unit) {
@Suppress("DEPRECATION")

View File

@ -40,7 +40,7 @@ abstract class BotImpl<N : BotNetworkHandler> constructor(
?: CoroutineExceptionHandler { _, e -> logger.error("An exception was thrown under a coroutine of Bot", e) })
override val context: Context by context.unsafeWeakRef()
@UseExperimental(LowLevelAPI::class)
@OptIn(LowLevelAPI::class)
@Suppress("CanBePrimaryConstructorProperty", "OverridingDeprecatedMember") // for logger
final override val account: BotAccount = account

View File

@ -15,7 +15,7 @@ import net.mamoe.mirai.utils.MiraiInternalAPI
* 表明这个 API 是为了让 Java 使用者调用更方便.
*/
@MiraiInternalAPI
@Experimental(level = Experimental.Level.ERROR)
@RequiresOptIn(level = RequiresOptIn.Level.ERROR)
@Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS)
annotation class JavaHappyAPI

View File

@ -58,7 +58,7 @@ suspend fun ByteReadChannel.copyTo(dst: Output) {
* 从接收者管道读取所有数据并写入 [dst]. 不会关闭 [dst]
*/
suspend fun ByteReadChannel.copyTo(dst: ByteWriteChannel) {
@UseExperimental(MiraiInternalAPI::class)
@OptIn(MiraiInternalAPI::class)
ByteArrayPool.useInstance { buffer ->
var size: Int
while (this.readAvailable(buffer).also { size = it } > 0) {
@ -126,7 +126,7 @@ suspend fun ByteReadChannel.copyAndClose(dst: Output) {
suspend fun ByteReadChannel.copyAndClose(dst: ByteWriteChannel) {
@Suppress("DuplicatedCode")
try {
@UseExperimental(MiraiInternalAPI::class)
@OptIn(MiraiInternalAPI::class)
ByteArrayPool.useInstance { buffer ->
var size: Int
while (this.readAvailable(buffer).also { size = it } > 0) {
@ -145,7 +145,7 @@ suspend fun ByteReadChannel.copyAndClose(dst: ByteWriteChannel) {
suspend fun ByteReadChannel.copyAndClose(dst: io.ktor.utils.io.ByteWriteChannel) {
@Suppress("DuplicatedCode")
try {
@UseExperimental(MiraiInternalAPI::class)
@OptIn(MiraiInternalAPI::class)
ByteArrayPool.useInstance { buffer ->
var size: Int
while (this.readAvailable(buffer).also { size = it } > 0) {