Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin: Mutable collections have methods to change them and not notify the protocol #338

Open
ForNeVeR opened this issue Aug 29, 2022 · 0 comments
Assignees
Labels

Comments

@ForNeVeR
Copy link
Collaborator

Currently, there are some methods in mutable Rd collections (all implementors of IMutableViewableMap, IMutableViewableList, and IMutableViewableSet) that will modify the collections but won't trigger the accompanying action (such as taking a cookie, writing the value to the protocol etc.).

This is caused by two issues:

  1. Interface delegation (i.e. IMutableViewableMap<K, V> by map clause in the RdMap's inheritance list) will just call all the methods from the base object without wrapping them, if they aren't overridden in the implementing class. So, this delegation should be removed.
  2. Mutable collections in Kotlin expose members that allow indirect mutation of the collection: say, Map::entries: MutableCollection<Map.Entry>, or iterator: MutableIterator, or even MutableMap.MutableEntry.

Particularly problematic methods in this regard are variations of MutableList::addAll and MutableMap::putAll (soon to be fixed), but I'm not sure about a systematic solution, yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant