Description
When using the DiffableUtils.diff with a vanilla OpenJDK Map, instead of the legacy ImmutableOpenMap interface, we return a mutable map (generic HashMap), which isn't the expected behaviour of the API:
|
public static <K, T extends Diffable<T>> MapDiff<K, T, Map<K, T>> diff( |
We should wrap the map returned by the diff API in an unmodifiable version.
Description
When using the DiffableUtils.diff with a vanilla OpenJDK Map, instead of the legacy ImmutableOpenMap interface, we return a mutable map (generic HashMap), which isn't the expected behaviour of the API:
elasticsearch/server/src/main/java/org/elasticsearch/cluster/DiffableUtils.java
Line 85 in 45c56b2
We should wrap the map returned by the diff API in an unmodifiable version.