Sdk (@Nullable Comparator<? super Sdk> comparator, SdkType @NotNull ... sdkTypes) { final Project defaultProject = ProjectManager.getInstance().getDefaultProject(); final Sdk sdk = ProjectRootManager.getInstance(defaultProject).getProjectSdk(); if (sdk != null && ArrayUtil.contains(sdk.getSdkType(), sdkTypes)) { return sdk; } for (SdkType type : sdkTypes) { List<Sdk> sdks = ProjectJdkTable.getInstance().getSdksOfType(type); if (!sdks.isEmpty()) { if (comparator != null) { sdks.sort(comparator); } return sdks.get(0); } } for (SdkType sdkType : sdkTypes) { for(String suggestedHomePath : sdkType.suggestHomePaths()) { if (sdkType.isValidSdkHome(suggestedHomePath)) { Sdk an_sdk = createAndAddSDK(suggestedHomePath, sdkType); if (an_sdk != null) return an_sdk; } } } return null; }