void (@NotNull final Project project) { EdtTestUtil.runInEdtAndWait(() -> { final JavaAwareProjectJdkTableImpl table = JavaAwareProjectJdkTableImpl.getInstanceEx(); ApplicationManager.getApplication().runWriteAction(() -> { Sdk internalJdk = table.getInternalJdk(); for (Module module : ModuleManager.getInstance(project).getModules()) { Sdk sdk = ModuleRootManager.getInstance(module).getSdk(); if (sdk != null && sdk.equals(internalJdk)) { ModuleRootModificationUtil.setModuleSdk(module, null); } } if (table.findJdk(internalJdk.getName(), internalJdk.getSdkType().getName()) == internalJdk) { table.removeJdk(internalJdk); } BuildManager.getInstance().clearState(project); }); }); }