void () { DefaultLogger.disableStderrDumping(getTestRootDisposable()); final VirtualFile vFile = myFixture.addClass("class Foo {}").getContainingFile().getVirtualFile(); Ref<PsiClass> clazz = Ref.create(findClass("Foo")); assert clazz.get() != null; runFindClassStubIndexQueryThatProducesInvalidResult("Foo"); GCWatcher.fromClearedRef(clazz).ensureCollected(); assertNotNull(findClass("Foo")); // check invalidation of transient indices state final Document document = FileDocumentManager.getInstance().getDocument(vFile); WriteCommandAction.runWriteCommandAction(getProject(), () -> document.setText("class Foo2 {}")); PsiDocumentManager.getInstance(getProject()).commitDocument(document); clazz = Ref.create(findClass("Foo2")); assert clazz.get() != null; runFindClassStubIndexQueryThatProducesInvalidResult("Foo2"); GCWatcher.fromClearedRef(clazz).ensureCollected(); assertNotNull(findClass("Foo2")); }