boolean (Project project, Module[] modules) { return ProgressManager.getInstance().run(new Task.WithResult<Boolean, RuntimeException>(project, JavaBundle.message("dialog.title.check.configuration"), true) { @Override protected Boolean compute(@NotNull ProgressIndicator indicator) throws RuntimeException { boolean anyModuleAcceptsSdk = false; boolean anyModuleUsesProjectSdk = false; Sdk projectSdk = ProjectRootManager.getInstance(project).getProjectSdk(); for (Module module : modules) { if (ModuleRootManager.getInstance(module).isSdkInherited()) { anyModuleUsesProjectSdk = true; if (ModuleType.get(module).isValidSdk(module, projectSdk)) { anyModuleAcceptsSdk = true; } } } return anyModuleUsesProjectSdk && !anyModuleAcceptsSdk; } }); }