private static @Nullable GradleVersion getGradleVersion(@Nullable BuildEnvironment buildEnvironment) {
    return Optional.ofNullable(buildEnvironment)
      .map(it -> it.getGradle())
      .map(it -> it.getGradleVersion())
      .map(it -> GradleInstallationManager.getGradleVersionSafe(it))
      .orElse(null);
  }
private static @Nullable GradleVersion getGradleVersion(@Nullable BuildEnvironment buildEnvironment)