Add documentation for mutating operations of unmodifiable maps.
Simply states that the operation is not supported.
Fixed #28918
BUG= http://dartbug.com/28918
R=lrn@google.com
Review-Url: https://codereview.chromium.org/2722613004 .
diff --git a/sdk/lib/collection/maps.dart b/sdk/lib/collection/maps.dart
index c928287..d8dfcfc 100644
--- a/sdk/lib/collection/maps.dart
+++ b/sdk/lib/collection/maps.dart
@@ -156,18 +156,23 @@
* Mixin that overrides mutating map operations with implementations that throw.
*/
abstract class _UnmodifiableMapMixin<K, V> implements Map<K, V> {
+ /** This operation is not supported by an unmodifiable map. */
void operator[]=(K key, V value) {
throw new UnsupportedError("Cannot modify unmodifiable map");
}
+ /** This operation is not supported by an unmodifiable map. */
void addAll(Map<K, V> other) {
throw new UnsupportedError("Cannot modify unmodifiable map");
}
+ /** This operation is not supported by an unmodifiable map. */
void clear() {
throw new UnsupportedError("Cannot modify unmodifiable map");
}
+ /** This operation is not supported by an unmodifiable map. */
V remove(Object key) {
throw new UnsupportedError("Cannot modify unmodifiable map");
}
+ /** This operation is not supported by an unmodifiable map. */
V putIfAbsent(K key, V ifAbsent()) {
throw new UnsupportedError("Cannot modify unmodifiable map");
}