diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/ex/dummy/DummyCachingFileSystem.java b/platform/platform-impl/src/com/intellij/openapi/vfs/ex/dummy/DummyCachingFileSystem.java index 3b5c4e60c296..33de7529e278 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/ex/dummy/DummyCachingFileSystem.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/ex/dummy/DummyCachingFileSystem.java @@ -32,6 +32,7 @@ import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.util.Collection; +import java.util.Map; import java.util.Objects; import java.util.concurrent.ConcurrentMap; import java.util.stream.Collectors; @@ -161,10 +162,10 @@ public abstract class DummyCachingFileSystem extends Dumm } protected void clearInvalidFiles() { - Collection values = myCachedFiles.values(); - for (T t : values) { + for (Map.Entry entry : myCachedFiles.entrySet()) { + T t = entry.getValue(); if (t == null || !t.isValid()) { - values.remove(t); + myCachedFiles.remove(entry.getKey()); } } }