Deprecate BotConfiguration.json

This commit is contained in:
Him188 2022-04-24 15:28:07 +01:00
parent a4562a7aef
commit 7f85319a92
3 changed files with 20 additions and 12 deletions

View File

@ -1,10 +1,10 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
* Copyright 2019-2022 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.
* 此源代码的使用受 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
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
@file:Suppress("unused", "DEPRECATION_ERROR", "EXPOSED_SUPER_CLASS", "MemberVisibilityCanBePrivate")
@ -63,6 +63,11 @@ public open class BotConfiguration { // open for Java
* Json 序列化器, 使用 'kotlinx.serialization'
*/
@MiraiExperimentalApi
@Deprecated(
"Changing serial format is going to be forbidden. Deprecated for removal. ",
level = DeprecationLevel.ERROR
)
@DeprecatedSinceMirai("")
public var json: Json = kotlin.runCatching {
Json {
isLenient = true
@ -581,6 +586,7 @@ public open class BotConfiguration { // open for Java
return BotConfiguration().also { new ->
// To structural order
new.workingDir = workingDir
@Suppress("DEPRECATION_ERROR")
new.json = json
new.parentCoroutineContext = parentCoroutineContext
new.heartbeatPeriodMillis = heartbeatPeriodMillis

View File

@ -1,10 +1,10 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
* Copyright 2019-2022 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.
* 此源代码的使用受 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
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
package net.mamoe.mirai.utils
@ -84,6 +84,7 @@ public expect abstract class LoginSolver() {
internal fun BotConfiguration.getFileBasedDeviceInfoSupplier(file: () -> File): (Bot) -> DeviceInfo {
return {
@Suppress("DEPRECATION_ERROR")
file().loadAsDeviceInfo(json)
}
}

View File

@ -1,10 +1,10 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
* Copyright 2019-2022 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.
* 此源代码的使用受 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
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/
package net.mamoe.mirai.internal.network.components
@ -43,6 +43,7 @@ internal class ContactCacheServiceImpl(
// contact cache
///////////////////////////////////////////////////////////////////////////
@Suppress("DEPRECATION_ERROR")
inline val json get() = configuration.json
override val friendListCache: FriendListCache? by lazy {