diff --git a/mirai-core-api/src/commonMain/kotlin/event/events/friend.kt b/mirai-core-api/src/commonMain/kotlin/event/events/friend.kt index 251b2e2f0..7a11e775c 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/events/friend.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/events/friend.kt @@ -39,7 +39,7 @@ public data class FriendRemarkChangeEvent internal constructor( @Deprecated( message = "Please use newRemark", replaceWith = ReplaceWith("newRemark"), - level = DeprecationLevel.WARNING + level = DeprecationLevel.ERROR ) val newName: String get() = newRemark } diff --git a/mirai-core/src/commonMain/kotlin/contact/FriendImpl.kt b/mirai-core/src/commonMain/kotlin/contact/FriendImpl.kt index 9e4e0b886..0f12d8e3b 100644 --- a/mirai-core/src/commonMain/kotlin/contact/FriendImpl.kt +++ b/mirai-core/src/commonMain/kotlin/contact/FriendImpl.kt @@ -56,13 +56,9 @@ import kotlin.time.measureTime internal class FriendInfoImpl( @JvmField private val jceFriendInfo: net.mamoe.mirai.internal.network.protocol.data.jce.FriendInfo ) : FriendInfo { - @JvmField - var cachedNick: String? = null - override val nick: String get() = cachedNick ?: jceFriendInfo.nick.also { cachedNick = it } + override var nick: String = jceFriendInfo.nick override val uin: Long get() = jceFriendInfo.friendUin - @JvmField - var cachedRemark: String? = null - override val remark: String get() = cachedRemark ?: jceFriendInfo.remark.also { cachedRemark = it } + override var remark: String = jceFriendInfo.remark } @OptIn(ExperimentalContracts::class) 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 86d5e7085..1d595d2ba 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 @@ -568,7 +568,7 @@ internal object Transformers528 : Map by mapOf( val old: String friend.checkIsFriendImpl().friendInfo.checkIsInfoImpl() .also { info -> old = info.remark } - .cachedRemark = it.rmkName + .remark = it.rmkName // TODO: 2020/4/10 ADD REMARK QUERY FriendRemarkChangeEvent(friend, old, it.rmkName) } ?: emptySequence() @@ -701,7 +701,7 @@ internal object Transformers528 : Map by mapOf( val from = info.nick when (info) { is FriendInfoImpl -> { - info.cachedNick = to + info.nick = to } is MemberInfoImpl -> { info._nick = to