revert "increment index modification stamp on transient data deletion"

GitOrigin-RevId: 21f06700b922f24e8f55de51c09f13b3300d2c40
This commit is contained in:
Dmitry Batkovich
2019-10-07 18:34:38 +00:00
committed by intellij-monorepo-bot
parent db50a48ebe
commit 5c4d3e5ed1
2 changed files with 0 additions and 36 deletions
@@ -1133,39 +1133,4 @@ class IndexTest extends JavaCodeInsightFixtureTestCase {
VfsUtil.saveText(vFile, "class Foo { void m() { int k = 0; } }")
assertTrue(stamp == ((FileBasedIndexImpl)FileBasedIndex.instance).getIndexModificationStamp(StubUpdatingIndex.INDEX_ID, project))
}
void "test index stamp update on transient data deletion"() {
def stamp = ((FileBasedIndexImpl)FileBasedIndex.instance).getIndexModificationStamp(StubUpdatingIndex.INDEX_ID, project)
def file = myFixture.addClass("class Foo {}").getContainingFile()
assert findClass("Foo") != null
PsiDocumentManager.getInstance(getProject()).commitAllDocuments()
assertTrue(stamp != ((FileBasedIndexImpl)FileBasedIndex.instance).getIndexModificationStamp(StubUpdatingIndex.INDEX_ID, project))
stamp = ((FileBasedIndexImpl)FileBasedIndex.instance).getIndexModificationStamp(StubUpdatingIndex.INDEX_ID, project)
PsiDocumentManager.getInstance(getProject()).commitAllDocuments()
((PsiJavaFile)file).getImportList().add(JavaPsiFacade.getElementFactory(getProject()).createImportStatementOnDemand("java.io"))
assert findClass("Foo") != null
PsiDocumentManager.getInstance(getProject()).commitAllDocuments()
assertTrue(stamp != ((FileBasedIndexImpl)FileBasedIndex.instance).getIndexModificationStamp(StubUpdatingIndex.INDEX_ID, project))
stamp = ((FileBasedIndexImpl)FileBasedIndex.instance).getIndexModificationStamp(StubUpdatingIndex.INDEX_ID, project)
PsiDocumentManager.getInstance(getProject()).commitAllDocuments()
findClass("Foo").replace(findClass("Foo").copy())
assert findClass("Foo") != null
PsiDocumentManager.getInstance(getProject()).commitAllDocuments()
assertTrue(stamp == ((FileBasedIndexImpl)FileBasedIndex.instance).getIndexModificationStamp(StubUpdatingIndex.INDEX_ID, project))
stamp = ((FileBasedIndexImpl)FileBasedIndex.instance).getIndexModificationStamp(StubUpdatingIndex.INDEX_ID, project)
PsiDocumentManager.getInstance(getProject()).commitAllDocuments()
PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting()
PsiManager.getInstance(getProject()).reloadFromDisk(file)
assert findClass("Foo") != null
PsiDocumentManager.getInstance(getProject()).commitAllDocuments()
assertTrue(stamp != ((FileBasedIndexImpl)FileBasedIndex.instance).getIndexModificationStamp(StubUpdatingIndex.INDEX_ID, project))
stamp = ((FileBasedIndexImpl)FileBasedIndex.instance).getIndexModificationStamp(StubUpdatingIndex.INDEX_ID, project)
findClass("Foo").replace(findClass("Foo").copy())
assert findClass("Foo") != null
assertTrue(stamp != ((FileBasedIndexImpl)FileBasedIndex.instance).getIndexModificationStamp(StubUpdatingIndex.INDEX_ID, project))
}
}
@@ -174,7 +174,6 @@ public class VfsAwareMapReduceIndex<Key, Value, Input> extends MapReduceIndex<Ke
@Override
public void removeTransientDataForFile(int inputId) {
myModificationStamp.incrementAndGet();
Lock lock = getWriteLock();
lock.lock();
try {