mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 08:04:45 +00:00
Phase 2 of the iOS plan — clears the java.lang.ref.WeakReference blocker from commons/commonMain. Four model files migrated; one additional sync primitive replaced. - Adds expect class WeakReference<T : Any> in commons/commonMain/util/, with a jvmAndroid actual that typealiases to java.lang.ref.WeakReference. iOS actual will typealias to kotlin.native.ref.WeakReference when the target is added. - Channel / Chatroom / MarmotGroupChatroom: the WeakReference(null) initializer relied on platform-type nullability of java.lang.ref.WeakReference's constructor. With T : Any in the expect class, fields become nullable (WeakReference<...>? = null) and the .get() callsites become ?.get(). Behaviorally equivalent. - UserRelaysCache: same WeakReference migration, plus the synchronized(this) double-checked-locking idiom is replaced with co.touchlab.stately.concurrency.Lock + withLock (KMP). kotlin.synchronized is JVM-only; Lock comes in transitively via stately-concurrent-collections already added in the previous PR. Model-layer @Synchronized usage in Channel/Chatroom/MarmotGroupChatroom/ Note (also JVM-only) is a separate iOS blocker and a separate PR.