diff --git a/platform/util/src/com/intellij/util/containers/ConcurrentFactoryMap.java b/platform/util/src/com/intellij/util/containers/ConcurrentFactoryMap.java index b2bfd3bc6f9e..0f0be5a4a75e 100644 --- a/platform/util/src/com/intellij/util/containers/ConcurrentFactoryMap.java +++ b/platform/util/src/com/intellij/util/containers/ConcurrentFactoryMap.java @@ -14,10 +14,10 @@ import java.util.concurrent.ConcurrentMap; import java.util.function.Supplier; /** - * a ConcurrentMap which computes the value associated with the key (via {@link #create(Object)} method) on first {@link #get(Object)} access. - * THREAD SAFE. + * ConcurrentMap which computes the value associated with the key (via {@link #create(Object)} method) on first {@link #get(Object)} access. + * This map is THREAD SAFE. * It's guaranteed that two {@link #get(Object)} method calls with the same key will return the same value (i.e. the created value stored atomically). - * For not thread-safe (but possible faster and more memory-efficient) alternative please use {@link FactoryMap} + * For the not thread-safe (but possibly faster and more memory-efficient) alternative please use {@link FactoryMap} instead. */ public abstract class ConcurrentFactoryMap implements ConcurrentMap { private final ConcurrentMap myMap = createMap(); @@ -167,6 +167,11 @@ public abstract class ConcurrentFactoryMap implements ConcurrentMap { return nullize(myMap.replace(notNull(key), notNull(value))); } + @Override + public String toString() { + return myMap.toString(); + } + @NotNull public static ConcurrentMap createMap(@NotNull final Function computeValue) { return new ConcurrentFactoryMap() { diff --git a/platform/util/src/com/intellij/util/containers/FactoryMap.java b/platform/util/src/com/intellij/util/containers/FactoryMap.java index 1486d1dd22de..ec25d6397868 100644 --- a/platform/util/src/com/intellij/util/containers/FactoryMap.java +++ b/platform/util/src/com/intellij/util/containers/FactoryMap.java @@ -29,9 +29,9 @@ import java.util.*; import java.util.function.Supplier; /** - * a Map which computes the value associated with the key (via {@link #create(Object)} method) on first {@link #get(Object)} access. - * NOT THREAD SAFE. - * For thread-safe alternative please use {@link ConcurrentFactoryMap} + * Map which computes the value associated with the key (via {@link #create(Object)} method) on first {@link #get(Object)} access. + * This map is NOT THREAD SAFE. + * For the thread-safe alternative please use {@link ConcurrentFactoryMap} instead. */ public abstract class FactoryMap implements Map { private Map myMap; @@ -175,6 +175,11 @@ public abstract class FactoryMap implements Map { entry -> new AbstractMap.SimpleEntry<>(nullize(entry.getKey()), nullize(entry.getValue()))); } + @Override + public String toString() { + return String.valueOf(myMap); + } + @NotNull public static Map create(@NotNull final Function computeValue) { return new FactoryMap(true) {