From dd143890cd60c0b939db2f6276b6915ad1750470 Mon Sep 17 00:00:00 2001 From: Karlatemp Date: Tue, 8 Nov 2022 12:41:02 +0800 Subject: [PATCH] [core] Fix bad atomic --- .../kotlin/message/source/incomingSourceImpl.kt | 8 ++++---- .../commonMain/kotlin/message/source/offlineSourceImpl.kt | 2 +- .../kotlin/message/source/outgoingSourceImpl.kt | 8 ++++---- .../commonMain/kotlin/network/components/SsoProcessor.kt | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mirai-core/src/commonMain/kotlin/message/source/incomingSourceImpl.kt b/mirai-core/src/commonMain/kotlin/message/source/incomingSourceImpl.kt index 6ab9dcd26..eac8b5edb 100644 --- a/mirai-core/src/commonMain/kotlin/message/source/incomingSourceImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/source/incomingSourceImpl.kt @@ -53,7 +53,7 @@ internal class OnlineMessageSourceFromFriendImpl( private val _isRecalledOrPlanned = atomic(false) @Transient - override val isRecalledOrPlanned: Boolean = _isRecalledOrPlanned.value + override val isRecalledOrPlanned: Boolean get() = _isRecalledOrPlanned.value override fun setRecalled(): Boolean = _isRecalledOrPlanned.compareAndSet(expect = false, update = true) override val ids: IntArray get() = sequenceIds // msg.msgBody.richText.attr!!.random override val internalIds: IntArray = msg.mapToIntArray { @@ -91,7 +91,7 @@ internal class OnlineMessageSourceFromStrangerImpl( private val _isRecalledOrPlanned = atomic(false) @Transient - override val isRecalledOrPlanned: Boolean = _isRecalledOrPlanned.value + override val isRecalledOrPlanned: Boolean get() = _isRecalledOrPlanned.value override fun setRecalled(): Boolean = _isRecalledOrPlanned.compareAndSet(expect = false, update = true) override val ids: IntArray get() = sequenceIds // msg.msgBody.richText.attr!!.random @@ -170,7 +170,7 @@ internal class OnlineMessageSourceFromTempImpl( private val _isRecalledOrPlanned = atomic(false) @Transient - override val isRecalledOrPlanned: Boolean = _isRecalledOrPlanned.value + override val isRecalledOrPlanned: Boolean get() = _isRecalledOrPlanned.value override fun setRecalled(): Boolean = _isRecalledOrPlanned.compareAndSet(expect = false, update = true) override val ids: IntArray get() = sequenceIds // @@ -211,7 +211,7 @@ internal class OnlineMessageSourceFromGroupImpl( private val _isRecalledOrPlanned = atomic(false) @Transient - override val isRecalledOrPlanned: Boolean = _isRecalledOrPlanned.value + override val isRecalledOrPlanned: Boolean get() = _isRecalledOrPlanned.value override fun setRecalled(): Boolean = _isRecalledOrPlanned.compareAndSet(expect = false, update = true) override val sequenceIds: IntArray = msg.mapToIntArray { it.msgHead.msgSeq } override val internalIds: IntArray = msg.mapToIntArray { it.msgBody.richText.attr!!.random } diff --git a/mirai-core/src/commonMain/kotlin/message/source/offlineSourceImpl.kt b/mirai-core/src/commonMain/kotlin/message/source/offlineSourceImpl.kt index 104e4bcb1..ba05478a0 100644 --- a/mirai-core/src/commonMain/kotlin/message/source/offlineSourceImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/source/offlineSourceImpl.kt @@ -62,7 +62,7 @@ internal class OfflineMessageSourceImplData( private val _isRecalledOrPlanned = atomic(false) @Transient - override val isRecalledOrPlanned: Boolean = _isRecalledOrPlanned.value + override val isRecalledOrPlanned: Boolean get() = _isRecalledOrPlanned.value override fun setRecalled(): Boolean = _isRecalledOrPlanned.compareAndSet(expect = false, update = true) override fun toJceData(): ImMsgBody.SourceMsg { diff --git a/mirai-core/src/commonMain/kotlin/message/source/outgoingSourceImpl.kt b/mirai-core/src/commonMain/kotlin/message/source/outgoingSourceImpl.kt index 658efe4b2..28b53934e 100644 --- a/mirai-core/src/commonMain/kotlin/message/source/outgoingSourceImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/source/outgoingSourceImpl.kt @@ -102,7 +102,7 @@ internal class OnlineMessageSourceToFriendImpl( private val _isRecalledOrPlanned = atomic(false) @Transient - override val isRecalledOrPlanned: Boolean = _isRecalledOrPlanned.value + override val isRecalledOrPlanned: Boolean get() = _isRecalledOrPlanned.value override fun setRecalled(): Boolean = _isRecalledOrPlanned.compareAndSet(expect = false, update = true) private val jceData: ImMsgBody.SourceMsg by lazy { toJceDataImpl(subject) } @@ -141,7 +141,7 @@ internal class OnlineMessageSourceToStrangerImpl( private val _isRecalledOrPlanned = atomic(false) @Transient - override val isRecalledOrPlanned: Boolean = _isRecalledOrPlanned.value + override val isRecalledOrPlanned: Boolean get() = _isRecalledOrPlanned.value override fun setRecalled(): Boolean = _isRecalledOrPlanned.compareAndSet(expect = false, update = true) private val jceData: ImMsgBody.SourceMsg by lazy { toJceDataImpl(subject) } @@ -180,7 +180,7 @@ internal class OnlineMessageSourceToTempImpl( private val _isRecalledOrPlanned = atomic(false) @Transient - override val isRecalledOrPlanned: Boolean = _isRecalledOrPlanned.value + override val isRecalledOrPlanned: Boolean get() = _isRecalledOrPlanned.value override fun setRecalled(): Boolean = _isRecalledOrPlanned.compareAndSet(expect = false, update = true) private val jceData: ImMsgBody.SourceMsg by lazy { toJceDataImpl(subject) } @@ -215,7 +215,7 @@ internal class OnlineMessageSourceToGroupImpl( private val _isRecalledOrPlanned = atomic(false) @Transient - override val isRecalledOrPlanned: Boolean = _isRecalledOrPlanned.value + override val isRecalledOrPlanned: Boolean get() = _isRecalledOrPlanned.value override fun setRecalled(): Boolean = _isRecalledOrPlanned.compareAndSet(expect = false, update = true) diff --git a/mirai-core/src/commonMain/kotlin/network/components/SsoProcessor.kt b/mirai-core/src/commonMain/kotlin/network/components/SsoProcessor.kt index 660e6367f..efccdff59 100644 --- a/mirai-core/src/commonMain/kotlin/network/components/SsoProcessor.kt +++ b/mirai-core/src/commonMain/kotlin/network/components/SsoProcessor.kt @@ -122,7 +122,7 @@ internal class SsoProcessorImpl( /////////////////////////////////////////////////////////////////////////// private val _firstLoginResult: AtomicRef = atomic(null) - override val firstLoginResult = _firstLoginResult.value + override val firstLoginResult get() = _firstLoginResult.value override fun casFirstLoginResult(expect: FirstLoginResult?, update: FirstLoginResult?): Boolean = _firstLoginResult.compareAndSet(expect, update)