private @NotNull Set<@NotNull String> listJavaHomeDirsInstalledBySdkMan(@NotNull Path javasDir) {
    var mac = this instanceof JavaHomeFinderMac;
    var result = new HashSet<@NotNull String>();

    try (Stream<Path> stream = Files.list(javasDir)) {
      List<Path> innerDirectories = stream.filter(d -> Files.isDirectory(d)).toList();
      for (Path innerDir : innerDirectories) {
        var home = innerDir;
        if (!JdkUtil.checkForJdk(home)) continue;
        var releaseFile = home.resolve("release");

        if (mac) {
          // Zulu JDK on macOS has a rogue layout, with which Gradle failed to operate (see the bugreport IDEA-253051),
          // and in order to get Gradle working with Zulu JDK we should use it's second home (when symbolic links are resolved).
          try {
            if (Files.isSymbolicLink(releaseFile)) {
              var realReleaseFile = releaseFile.toRealPath();
              if (!safeExists(realReleaseFile)) {
                log.warn("Failed to resolve the target file (it doesn't exist) for: " + releaseFile);
                continue;
              }
              var realHome = realReleaseFile.getParent();
              if (realHome == null) {
                log.warn("Failed to resolve the target file (it has no parent dir) for: " + releaseFile);
                continue;
              }
              home = realHome;
            }
          }
          catch (IOException ioe) {
            log.warn("Failed to resolve the target file for: " + releaseFile + ": " + ioe.getMessage());
            continue;
          }
          catch (Exception e) {
            log.warn("Failed to resolve the target file for: " +
                     releaseFile + ": Unexpected exception " + e.getClass().getSimpleName() + ": " + e.getMessage());
            continue;
          }
        }

        result.add(home.toString());
      }
    }
    catch (IOException ioe) {
      log.warn("I/O exception while listing Java home directories installed by Sdkman: " + ioe.getMessage(), ioe);
      return Collections.emptySet();
    }
    catch (Exception e) {
      log.warn("Unexpected exception while listing Java home directories installed by Sdkman: " +
               e.getClass().getSimpleName() +
               ": " +
               e.getMessage(), e);
      return Collections.emptySet();
    }

    return result;
  }
private @NotNull Set<@NotNull String> listJavaHomeDirsInstalledBySdkMan(@NotNull Path javasDir)