@SuppressWarnings("DeprecatedIsStillUsed")
  @Deprecated(forRemoval = true)
  @Nullable
  private static Sdk chooseJdk(@NotNull Project project, @NotNull Collection<? extends Module> modules) {
    Sdk projectJdk = ProjectRootManager.getInstance(project).getProjectSdk();
    if (projectJdk != null && projectJdk.getSdkType() instanceof JavaSdkType) {
      return projectJdk;
    }
    List<Sdk> jdks = ContainerUtil.mapNotNull(modules, module -> {
      if (module == null) return null;
      Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
      if (sdk == null || !(sdk.getSdkType() instanceof JavaSdkType)) return null;
      return sdk;
    });
    if (jdks.isEmpty()) {
      return null;
    }
    return jdks.stream().max(Comparator.comparing(jdk -> JavaVersion.tryParse(jdk.getVersionString()), Comparator.nullsFirst(Comparator.naturalOrder()))).orElse(null);
  }
@SuppressWarnings("DeprecatedIsStillUsed")
  @Deprecated(forRemoval = true)
  @Nullable
  private static Sdk chooseJdk(@NotNull Project project, @NotNull Collection<? extends Module> modules)