void (@NotNull LightProjectDescriptor descriptor) { ourProjectDescriptor = descriptor; if (ourProject != null) { closeAndDeleteProject(); } ApplicationManager.getApplication().runWriteAction(() -> cleanPersistedVFSContent()); Path tempDirectory = TemporaryDirectory.generateTemporaryPath(ProjectImpl.LIGHT_PROJECT_NAME + ProjectFileType.DOT_DEFAULT_EXTENSION); ourProject = Objects.requireNonNull(ProjectManagerEx.getInstanceEx().newProject(tempDirectory, descriptor.getOpenProjectOptions())); HeavyPlatformTestCase.synchronizeTempDirVfs(tempDirectory); ourPsiManager = null; try { ourProjectDescriptor.setUpProject(ourProject, new LightProjectDescriptor.SetupHandler() { @Override public void moduleCreated(@NotNull Module module) { //noinspection AssignmentToStaticFieldFromInstanceMethod ourModule = module; } @Override public void sourceRootCreated(@NotNull VirtualFile sourceRoot) { //noinspection AssignmentToStaticFieldFromInstanceMethod ourSourceRoot = sourceRoot; } }); } catch (Throwable e) { try { closeAndDeleteProject(); } catch (Throwable suppressed) { e.addSuppressed(suppressed); } throw new RuntimeException(e); } }