private @NotNull Set<String> findJavaInstalledByBrew() {
    var found = new HashSet<String>();
    var paths = List.of("/opt/homebrew/Cellar/", "/usr/homebrew/Cellar/");
    for (String path : paths) {
      Path parentFolder = getPathInUserHome(path);
      // JDKs installed by Homebrew can be hidden in `libexec`
      processSubfolders(parentFolder, formula -> {
        processSubfolders(formula, version -> {
          processSubfolders(version, subFolder -> {
            if (subFolder.getFileName().toString().equals("libexec")) {
              found.addAll(
                scanAll(subFolder, true).stream()
                  .filter(jdkPath -> !Files.isSymbolicLink(Path.of(jdkPath)))
                  .collect(Collectors.toSet())
              );
            }
          });
        });
      });
    }

    return found;
  }
private @NotNull Set<String> findJavaInstalledByBrew()