public static @NotNull Pair<@NotNull Sdk, @Nullable JavaSdkVersion> getBuildProcessRuntimeSdk(@NotNull Project project) {

    return getRuntimeSdk(project, MINIMUM_REQUIRED_JPS_BUILD_JAVA_VERSION, processed -> {
      // build's fallback SDK choosing policy: select among unprocessed SDKs in the SDK table the oldest possible one that can be used
      // select only SDKs that match project's WSL VM, if any
      Supplier<WSLDistribution> projectWslDistribution = new Supplier<>() {
        private WSLDistribution val;
        @Override
        public WSLDistribution get() {
          return val != null? val : (val = findWSLDistribution(project));
        }
      };
      Predicate<Sdk> sdkFilter = sdk -> !processed.contains(sdk) && Objects.equals(projectWslDistribution.get(), findWSLDistribution(sdk));

      return StreamEx.of(ProjectJdkTable.getInstance().getSdksOfType(JavaSdk.getInstance()))
        .filter(sdkFilter)
        .mapToEntry(sdk -> JavaVersion.tryParse(sdk.getVersionString()))
        .filterValues(version -> version != null && version.isAtLeast(MINIMUM_REQUIRED_JPS_BUILD_JAVA_VERSION))
        .min(Map.Entry.comparingByValue())
        .map(p -> Pair.create(p.getKey(), JavaSdkVersion.fromJavaVersion(p.getValue())))
        .filter(p -> p.second != null)
        .orElseGet(BuildManager::getIDERuntimeSdk);
    });
  }
public static @NotNull Pair<@NotNull Sdk, @Nullable JavaSdkVersion> getBuildProcessRuntimeSdk(@NotNull Project project)