private static @Nullable File getJavaToolchainHome(@NotNull Project project, @NotNull JavaCompile javaCompile) {
    if (GradleVersionUtil.isCurrentGradleOlderThan("6.7")) {
      return null;
    }
    Property<JavaCompiler> compiler = javaCompile.getJavaCompiler();
    if (!compiler.isPresent()) {
      return null;
    }
    try {
      JavaInstallationMetadata metadata = compiler.get().getMetadata();
      File javaToolchainHome = metadata.getInstallationPath().getAsFile();
      if (GradleVersionUtil.isCurrentGradleOlderThan("8.0")) {
        return javaToolchainHome;
      }
      if (metadata instanceof JavaToolchain) {
        JavaToolchain javaToolchain = (JavaToolchain)metadata;
        if (!javaToolchain.isFallbackToolchain()) {
          return javaToolchainHome;
        }
      }
    }
    catch (Throwable e) {
      Logger logger = project.getLogger();
      logger.warn(String.format("Skipping java toolchain information for %s : %s", javaCompile.getPath(), e.getMessage()));
      logger.info(String.format("Failed to resolve java toolchain info for %s", javaCompile.getPath()), e);
    }
    return null;
  }
private static @Nullable File getJavaToolchainHome(@NotNull Project project, @NotNull JavaCompile javaCompile)