diff --git a/src/main/java/org/elasticsearch/common/collect/ImmutableOpenMap.java b/src/main/java/org/elasticsearch/common/collect/ImmutableOpenMap.java index 7f2bfd2c51a..8148b7f25c0 100644 --- a/src/main/java/org/elasticsearch/common/collect/ImmutableOpenMap.java +++ b/src/main/java/org/elasticsearch/common/collect/ImmutableOpenMap.java @@ -137,7 +137,7 @@ public final class ImmutableOpenMap implements Iterable implements ObjectObjectMap { - private final ObjectObjectOpenHashMap map; + private ObjectObjectOpenHashMap map; public Builder() { //noinspection unchecked @@ -152,6 +152,8 @@ public final class ImmutableOpenMap implements Iterable build() { + ObjectObjectOpenHashMap map = this.map; + this.map = null; // nullify the map, so any operation post build will fail! (hackish, but safest) return new ImmutableOpenMap(map); }