gnodet commented on code in PR #1501:
URL: https://github.com/apache/maven/pull/1501#discussion_r1590366917
##########
api/maven-api-core/src/main/java/org/apache/maven/api/JavaPathType.java:
##########
@@ -63,16 +75,17 @@ public enum JavaPathType implements PathType {
* class-path.</li>
* </ul>
*/
- CLASSES("--class-path"),
+ CLASSES(StandardLocation.CLASS_PATH, "--class-path"),
Review Comment:
Is the `option` string still useful ? That looks really redundant and
specific to tool implementations. Can we only keep the `StandardLocation` ?
##########
api/maven-api-core/src/main/java/org/apache/maven/api/JavaPathType.java:
##########
@@ -40,6 +44,13 @@
* <p>Path types are often exclusive. For example, a dependency should not be
both on the Java class-path
* and on the Java module-path.</p>
*
+ * <h2>Relationship with Java compiler standard location</h2>
+ * This enumeration is closely related to the {@link JavaFileManager.Location}
enumerations.
+ * A difference is that the latter enumerate input and output files, while
{@code JavaPathType}
+ * enumerates only input dependencies. Another difference is that {@code
JavaPathType} contains
+ * some enumeration values used only at runtime and therefor not available in
{@code javax.tool},
Review Comment:
therefor -> therefore
##########
api/maven-api-core/src/main/java/org/apache/maven/api/PathType.java:
##########
@@ -94,23 +94,24 @@ public String option(Iterable<? extends Path> paths) {
* The path elements are separated by an option-specific or
platform-specific separator.
* If the given {@code paths} argument contains no element, then this
method returns an empty string.
*
- * <p><b>Examples:</b>
- * If {@code paths} is a list containing two elements, {@code path1} and
{@code path2}, then:
- * </p>
+ * <h4>Examples</h4>
+ * If {@code paths} is a list containing two elements, {@code dir/path1}
and {@code dir/path2}, then:
+ *
* <ul>
* <li>If this type is {@link JavaPathType#MODULES}, then this method
returns
- * {@code "--module-path path1:path2"} on Unix or {@code
"--module-path path1;path2"} on Windows.</li>
+ * {@code {"--module-path", "dir/path1:dir/path2"}} on Unix or
+ * {@code {"--module-path", "dir\path1;dir\path2"}} on Windows.</li>
* <li>If this type was created by {@code
JavaPathType.patchModule("foo.bar")}, then the method returns
- * {@code "--patch-module foo.bar=path1:path2"} on Unix or {@code
"--patch-module foo.bar=path1;path2"}
- * on Windows.</li>
+ * {@code {"--patch-module", "foo.bar=dir/path1:dir/path2"}} on Unix
or
+ * {@code {"--patch-module", "foo.bar=dir\path1;dir\path2"}} on
Windows.</li>
* </ul>
*
* @param paths the path to format as a string
* @return the option associated to this path type followed by the given
path elements,
- * or an empty string if there is no path element.
+ * or an empty array if there is no path element.
*/
@Nonnull
- String option(Iterable<? extends Path> paths);
+ String[] option(Iterable<? extends Path> paths);
Review Comment:
I wonder if this method should be moved out of the API.
##########
api/maven-api-core/src/main/java/org/apache/maven/api/JavaPathType.java:
##########
@@ -187,31 +247,38 @@ public Optional<String> option() {
*
* @param paths the path to format as a tool option
* @return the option associated to this path type followed by the given
path elements,
- * or an empty string if there is no path element
+ * or an empty array if there is no path element
* @throws IllegalStateException if no option is associated to this path
type
*/
@Nonnull
@Override
- public String option(Iterable<? extends Path> paths) {
+ public String[] option(Iterable<? extends Path> paths) {
return format(null, paths);
}
/**
* Implementation shared with {@link Modular}.
*/
- String format(String moduleName, Iterable<? extends Path> paths) {
+ final String[] format(String moduleName, Iterable<? extends Path> paths) {
Review Comment:
I wonder if this method should be moved out of the API.
##########
api/maven-api-core/src/main/java/org/apache/maven/api/JavaPathType.java:
##########
@@ -40,6 +44,13 @@
* <p>Path types are often exclusive. For example, a dependency should not be
both on the Java class-path
* and on the Java module-path.</p>
*
+ * <h2>Relationship with Java compiler standard location</h2>
+ * This enumeration is closely related to the {@link JavaFileManager.Location}
enumerations.
+ * A difference is that the latter enumerate input and output files, while
{@code JavaPathType}
Review Comment:
enumerate -> enumerates
##########
api/maven-api-core/src/main/java/org/apache/maven/api/JavaPathType.java:
##########
@@ -187,31 +247,38 @@ public Optional<String> option() {
*
* @param paths the path to format as a tool option
* @return the option associated to this path type followed by the given
path elements,
- * or an empty string if there is no path element
+ * or an empty array if there is no path element
* @throws IllegalStateException if no option is associated to this path
type
*/
@Nonnull
@Override
- public String option(Iterable<? extends Path> paths) {
+ public String[] option(Iterable<? extends Path> paths) {
Review Comment:
I wonder if this method should be moved out of the API.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]