Repository: GoogleContainerTools/jib
File: jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ExtraDirectoriesParameters.java (Java)

Code before:
  /**
   * Sets paths. {@code paths} can be any suitable object describing file paths convertible by
   * {@link Project#files} (such as {@link File}, {@code List<File>}, or {@code List<String>}).
   *
   * @param paths paths to set.
   */
  public void setPaths(Object paths) {
    this.paths.set(transformObjectToParametersList(paths));
  }

  /**
   * Sets paths, for lazy evaluation where {@code paths} is a {@link Provider} of a suitable object.
   *
   * @param paths provider of paths to set
   * @see #setPaths(Object)
   */
  public void setPaths(Provider<Object> paths) {
    this.paths.set(paths.map(this::transformObjectToParametersList));
  }

  /**
   * Helper method to convert {@code Object} to {@code List<ExtraDirectoryParameters>} in {@code
   * setFrom}.
   */
  @Nonnull
  private List<ExtraDirectoryParameters> transformObjectToParametersList(Object obj) {
    return project.files(obj).getFiles().stream()
        .map(file -> new ExtraDirectoryParameters(objects, project, file.toPath(), "/"))
        .collect(Collectors.toList());
  }

  /**
   * Gets the permissions for files in the extra layer on the container. Maps from absolute path on
   * the container to a 3-digit octal string representation of the file permission bits (e.g. {@code
   * "/path/on/container" -> "755"}).
   *
   * @return the permissions map from path on container to file permissions
   */
  @Input
  public MapProperty<String, String> getPermissions() {
    String property = System.getProperty(PropertyNames.EXTRA_DIRECTORIES_PERMISSIONS);
    if (property != null) {
      Map<String, String> parsedPermissions =
          ConfigurationPropertyValidator.parseMapProperty(property);
      if (!parsedPermissions.equals(permissions.get())) {
        permissions.set(parsedPermissions);
      }
    }
    return permissions;
  }
}

Review comment (suggestion):
Since the parameter of this method already gives us an indication of what we are converting, how about we do the following?

```suggestion
  private List<ExtraDirectoryParameters> convertToExtraDirectoryParametersList(Object obj) {
```

Code after:
  /**
   * Sets paths. {@code paths} can be any suitable object describing file paths convertible by
   * {@link Project#files} (such as {@link File}, {@code List<File>}, or {@code List<String>}).
   *
   * @param paths paths to set.
   */
  public void setPaths(Object paths) {
    this.paths.set(convertToExtraDirectoryParametersList(paths));
  }

  /**
   * Sets paths, for lazy evaluation where {@code paths} is a {@link Provider} of a suitable object.
   *
   * @param paths provider of paths to set
   * @see #setPaths(Object)
   */
  public void setPaths(Provider<Object> paths) {
    this.paths.set(paths.map(this::convertToExtraDirectoryParametersList));
  }

  /**
   * Helper method to convert {@code Object} to {@code List<ExtraDirectoryParameters>} in {@code
   * setFrom}.
   */
  @Nonnull
  private List<ExtraDirectoryParameters> convertToExtraDirectoryParametersList(Object obj) {
    return project.files(obj).getFiles().stream()
        .map(file -> new ExtraDirectoryParameters(objects, project, file.toPath(), "/"))
        .collect(Collectors.toList());
  }

  /**
   * Gets the permissions for files in the extra layer on the container. Maps from absolute path on
   * the container to a 3-digit octal string representation of the file permission bits (e.g. {@code
   * "/path/on/container" -> "755"}).
   *
   * @return the permissions map from path on container to file permissions
   */
  @Input
  public MapProperty<String, String> getPermissions() {
    String property = System.getProperty(PropertyNames.EXTRA_DIRECTORIES_PERMISSIONS);
    if (property != null) {
      Map<String, String> parsedPermissions =
          ConfigurationPropertyValidator.parseMapProperty(property);
      if (!parsedPermissions.equals(permissions.get())) {
        permissions.set(parsedPermissions);
      }
    }
    return permissions;
  }
}