From 1747ed7fdac909555b021fd8e6e9577b85a5d8f1 Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Mon, 11 Jun 2018 17:21:51 +0200 Subject: [PATCH] cleanPersistentContent only for tested file --- .../vfs/newvfs/persistent/PersistentFSImpl.java | 10 +++++++++- .../openapi/vfs/local/LocalFileSystemTest.java | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java index be7de6237ef8..de0c1e4bf488 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java @@ -1314,6 +1314,11 @@ public class PersistentFSImpl extends PersistentFS implements ApplicationCompone return FSRecords.getName(id); } + @TestOnly + public void cleanPersistedContent(int id) { + doCleanPersistedContent(id); + } + @TestOnly public void cleanPersistedContents() { int[] roots = FSRecords.listRoots(); @@ -1329,10 +1334,13 @@ public class PersistentFSImpl extends PersistentFS implements ApplicationCompone } } else { - setFlag(id, MUST_RELOAD_CONTENT, true); + doCleanPersistedContent(id); } } + private static void doCleanPersistedContent(int id) { + setFlag(id, MUST_RELOAD_CONTENT, true); + } private static class FsRoot extends VirtualDirectoryImpl { private final String myName; diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java index 0b784b47dc1e..9c7e0c0202fb 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java @@ -336,7 +336,7 @@ public class LocalFileSystemTest extends BareTestFixtureTestCase { assertEquals(5, virtualFile.getLength()); FileUtil.writeToFile(file, "new content"); - ((PersistentFSImpl)PersistentFS.getInstance()).cleanPersistedContents(); + ((PersistentFSImpl)PersistentFS.getInstance()).cleanPersistedContent(((VirtualFileWithId)virtualFile).getId()); s = VfsUtilCore.loadText(virtualFile); assertEquals("new content", s); assertEquals(11, virtualFile.getLength());