void (@Nullable Project project) { Application app = ApplicationManager.getApplication(); if (app == null) { return; } NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); UndoManagerImpl globalInstance = (UndoManagerImpl)UndoManager.getGlobalInstance(); if (globalInstance != null) { globalInstance.dropHistoryInTests(); } if (project != null && !project.isDisposed()) { ((UndoManagerImpl)UndoManager.getInstance(project)).dropHistoryInTests(); ((DocumentReferenceManagerImpl)DocumentReferenceManager.getInstance()).cleanupForNextTest(); ((PsiManagerImpl)PsiManager.getInstance(project)).cleanupForNextTest(); } TestApplicationKt.cleanupApplicationCaches(app); }