JetBrains / JetBrains/rd

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

Open
#338 0 comments 0 reactions 1 assignee Claimed by @ForNeVeR View on GitHub
bug
Dominant language
C#
Stars
417
Forks
62
Avg merge
9h 15m
Merged PRs (30d)
7

Description

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 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`, 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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.