Repository: GoogleContainerTools/jib
File: jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessor.java (Java)

Code before:
  }

  /**
   * Writes a file only when needed (when the file does not exist or the existing file has a
   * different content). It reads the entire bytes into a {@code String} for content comparison, so
   * care should be taken when using this method for a huge file.
   *
   * @param file target file to write
   * @param content file content to write
   * @throws IOException if file I/O error
   */
  @VisibleForTesting
  static void writeFileConservatively(Path file, String content) throws IOException {
    if (Files.exists(file)) {
      String oldContent = new String(Files.readAllBytes(file), StandardCharsets.UTF_8);
      if (oldContent.equals(content)) {
        return;
      }
    }
    Files.createDirectories(file.getParent());
    Files.write(file, content.getBytes(StandardCharsets.UTF_8));
  }

  /**
   * Gets the suitable value for the base image. If the raw base image parameter is null, returns
   * {@code "jetty"} for WAR projects, or {@code "eclipse-temurin:{8|11|`7}-jre"} for non-WAR.
   *
   * @param projectProperties used for providing additional information
   * @return the base image
   * @throws IncompatibleBaseImageJavaVersionException when the Java version in the base image is
   *     incompatible with the Java version of the application to be containerized
   */
  @VisibleForTesting
  static String getDefaultBaseImage(ProjectProperties projectProperties)
      throws IncompatibleBaseImageJavaVersionException {
    if (projectProperties.isWarProject()) {
      return "jetty";
    }
    int javaVersion = projectProperties.getMajorJavaVersion();
    if (javaVersion <= 8) {
      return "eclipse-temurin:8-jre";
    } else if (javaVersion <= 11) {
      return "eclipse-temurin:11-jre";
    } else if (javaVersion <= 17) {
      return "eclipse-temurin:17-jre";
    }
    throw new IncompatibleBaseImageJavaVersionException(17, javaVersion);
  }

  /**
   * Parses the list of platforms to a set of {@link Platform}.

Review comment (suggestion):
```suggestion
   * {@code "jetty"} for WAR projects, or {@code "eclipse-temurin:{8|11|17}-jre"} for non-WAR.
```

Code after:
  }

  /**
   * Writes a file only when needed (when the file does not exist or the existing file has a
   * different content). It reads the entire bytes into a {@code String} for content comparison, so
   * care should be taken when using this method for a huge file.
   *
   * @param file target file to write
   * @param content file content to write
   * @throws IOException if file I/O error
   */
  @VisibleForTesting
  static void writeFileConservatively(Path file, String content) throws IOException {
    if (Files.exists(file)) {
      String oldContent = new String(Files.readAllBytes(file), StandardCharsets.UTF_8);
      if (oldContent.equals(content)) {
        return;
      }
    }
    Files.createDirectories(file.getParent());
    Files.write(file, content.getBytes(StandardCharsets.UTF_8));
  }

  /**
   * Gets the suitable value for the base image. If the raw base image parameter is null, returns
   * {@code "jetty"} for WAR projects, or {@code "eclipse-temurin:{8|11|17}-jre"} for non-WAR.
   *
   * @param projectProperties used for providing additional information
   * @return the base image
   * @throws IncompatibleBaseImageJavaVersionException when the Java version in the base image is
   *     incompatible with the Java version of the application to be containerized
   */
  @VisibleForTesting
  static String getDefaultBaseImage(ProjectProperties projectProperties)
      throws IncompatibleBaseImageJavaVersionException {
    if (projectProperties.isWarProject()) {
      return "jetty";
    }
    int javaVersion = projectProperties.getMajorJavaVersion();
    if (javaVersion <= 8) {
      return "eclipse-temurin:8-jre";
    } else if (javaVersion <= 11) {
      return "eclipse-temurin:11-jre";
    } else if (javaVersion <= 17) {
      return "eclipse-temurin:17-jre";
    }
    throw new IncompatibleBaseImageJavaVersionException(17, javaVersion);
  }

  /**
   * Parses the list of platforms to a set of {@link Platform}.