Repository: GoogleContainerTools/jib
File: jib-cli/src/main/java/com/google/cloud/tools/jib/cli/jar/JarFiles.java (Java)

Code before:
public class JarFiles {

  /**
   * Generates a {@link JibContainerBuilder} from contents of a jar file.
   *
   * @param jarPath path to the jar file
   * @param tempDirPath path to a temporary directory which will be used store the exploded jar's
   *     contents
   * @param mode mode for processing jar
   * @return JibContainerBuilder
   * @throws IOException if I/O error occurs when opening the jar file or if temporary directory
   *     provided doesn't exist
   * @throws InvalidImageReferenceException if the base image reference is invalid
   */
  public static JibContainerBuilder toJibContainerBuilder(
      Path jarPath, Path tempDirPath, ProcessingMode mode)
      throws IOException, InvalidImageReferenceException {

    // Use distroless as the base image.
    JibContainerBuilder containerBuilder = Jib.from("gcr.io/distroless/java");

    List<FileEntriesLayer> layers;
    List<String> entrypoint;
    if (mode.equals(ProcessingMode.packaged)) {
      layers = JarModeProcessor.createPackagedModeLayersForStandardJar(jarPath);
      entrypoint = JarModeProcessor.computeEntrypointForPackagedStandard(jarPath);
    } else {
      layers = JarModeProcessor.createExplodedModeLayersForStandardJar(jarPath, tempDirPath);
      entrypoint = JarModeProcessor.computeEntrypointForExplodedStandard(jarPath);
    }
    containerBuilder.setEntrypoint(entrypoint).setFileEntriesLayers(layers);
    return containerBuilder;
  }
}


Review comment (suggestion):
Maybe we can be consistent with the names. Given that the class name is already `JarModeProcessor`,

```suggestion
      layers = JarModeProcessor.createLayersForPackagedStandard(jarPath);
      entrypoint = JarModeProcessor.computeEntrypointForPackagedStandard(jarPath);
```
And unfortunately, renaming a method means renaming test methods too.

Code after:
public class JarFiles {

  /**
   * Generates a {@link JibContainerBuilder} from contents of a jar file.
   *
   * @param jarPath path to the jar file
   * @param tempDirPath path to a temporary directory which will be used store the exploded jar's
   *     contents
   * @param mode mode for processing jar
   * @return JibContainerBuilder
   * @throws IOException if I/O error occurs when opening the jar file or if temporary directory
   *     provided doesn't exist
   * @throws InvalidImageReferenceException if the base image reference is invalid
   */
  public static JibContainerBuilder toJibContainerBuilder(
      Path jarPath, Path tempDirPath, ProcessingMode mode)
      throws IOException, InvalidImageReferenceException {

    // Use distroless as the base image.
    JibContainerBuilder containerBuilder = Jib.from("gcr.io/distroless/java");

    List<FileEntriesLayer> layers;
    List<String> entrypoint;
    if (mode.equals(ProcessingMode.packaged)) {
      layers = JarModeProcessor.createLayersForPackagedStandard(jarPath);
      entrypoint = JarModeProcessor.computeEntrypointForPackagedStandard(jarPath);
    } else {
      layers = JarModeProcessor.createLayersForExplodedStandard(jarPath, tempDirPath);
      entrypoint = JarModeProcessor.computeEntrypointForExplodedStandard(jarPath);
    }
    containerBuilder.setEntrypoint(entrypoint).setFileEntriesLayers(layers);
    return containerBuilder;
  }
}