Hello, I am trying to use the Stately's Isolate Co...
# kotlin-native
Hello, I am trying to use the Stately's Isolate Collections library. However when I'm trying to iterate over an IsoMutableMap, then I get crash saying UnsupportedOperationException("Can't leak mutable reference"). In the IsoMutableMap.kt, this operations is blocked as below. Can someone share why 'entries' can leak mutable reference but not the 'values'? Also, Is there any other way to iterate over the entry set?
Copy code
override val entries: MutableSet<MutableMap.MutableEntry<K, V>>
    get() {
        throw UnsupportedOperationException("Can't leak mutable reference")
        // access { IsoMutableSet(fork(it.entries)) }
There was a reason. I wrote that ­čÖé
I remember. The default implementation of
retains a reference to it's parent. Stepping through that would likely try to return an instance of
across threads, which will crash. To properly implement
, we'd need to wrap the
MutableSet<MutableMap.MutableEntry<K, V>>
­čĹŹ 1