public static @NotNull Sdk getJdk(@NotNull Project project, @NotNull String name) throws ExternalSystemJdkException {
    if (MavenWslUtil.useWslMaven(project)) {
      return MavenWslUtil.getWslJdk(project, name);
    }
    if (name.equals(MavenRunnerSettings.USE_INTERNAL_JAVA) || project.isDefault()) {
      return JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk();
    }

    if (name.equals(MavenRunnerSettings.USE_PROJECT_JDK)) {
      Sdk res = ProjectRootManager.getInstance(project).getProjectSdk();

      if (res == null) {
        res = suggestProjectSdk(project);
      }

      if (res != null && res.getSdkType() instanceof JavaSdkType) {
        return res;
      }
      return JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk();
    }

    if (name.equals(MavenRunnerSettings.USE_JAVA_HOME)) {
      final String javaHome = ExternalSystemJdkUtil.getJavaHome();
      if (StringUtil.isEmptyOrSpaces(javaHome)) {
        throw new InvalidJavaHomeException(javaHome);
      }
      try {
        return JavaSdk.getInstance().createJdk("", javaHome);
      }
      catch (IllegalArgumentException e) {
        throw new InvalidJavaHomeException(javaHome);
      }
    }

    Sdk projectJdk = getSdkByExactName(name);
    if (projectJdk != null) return projectJdk;
    throw new InvalidSdkException(name);
  }
public static @NotNull Sdk getJdk(@NotNull Project project, @NotNull String name)