void (@NotNull Project project, @Nullable Comparator<? super Sdk> preferredSdkComparator, SdkType @NotNull ... sdkTypes) { Sdk existingSdk = ProjectRootManager.getInstance(project).getProjectSdk(); if (existingSdk != null && ArrayUtil.contains(existingSdk.getSdkType(), sdkTypes)) { return; } Sdk sdk = findOrCreateSdk(preferredSdkComparator, sdkTypes); if (sdk != null) { setDirectoryProjectSdk(project, sdk); } }