mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-24 06:10:09 +08:00
Replace use of Experimental
with OptIn
This commit is contained in:
parent
710379eb80
commit
c5d98cbefd
@ -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")
|
||||
|
@ -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
|
@ -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")
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user