Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ public Optional<String> option() {
* Returns the option followed by a string representation of the given path elements.
* For example, if this type is {@link #MODULES}, then the option is {@code "--module-path"}
* followed by the specified path elements.
* The paths are <em>not</em> quoted.
*
* @param paths the path to format as a tool option
* @return the option associated to this path type followed by the given path elements,
Expand All @@ -263,8 +264,8 @@ final String[] format(String moduleName, Iterable<? extends Path> paths) {
if (option == null) {
throw new IllegalStateException("No option is associated to this path type.");
}
String prefix = (moduleName == null) ? "\"" : (moduleName + "=\"");
StringJoiner joiner = new StringJoiner(File.pathSeparator, prefix, "\"");
String prefix = (moduleName == null) ? "" : (moduleName + '=');
StringJoiner joiner = new StringJoiner(File.pathSeparator, prefix, "");
joiner.setEmptyValue("");
for (Path p : paths) {
joiner.add(p.toString());
Expand Down Expand Up @@ -365,6 +366,7 @@ public Optional<String> option() {
* Returns the option followed by a string representation of the given path elements.
* 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.
* The paths are <em>not</em> quoted.
*
* @param paths the path to format as a string
* @return the option associated to this path type followed by the given path elements,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void testOption() {
String[] formatted = JavaPathType.MODULES.option(paths());
assertEquals(2, formatted.length);
assertEquals("--module-path", formatted[0]);
assertEquals(toPlatformSpecific("\"src/foo.java:src/bar.java\""), formatted[1]);
assertEquals(toPlatformSpecific("src/foo.java:src/bar.java"), formatted[1]);
}

/**
Expand All @@ -64,7 +64,7 @@ public void testModularOption() {
String[] formatted = JavaPathType.patchModule("my.module").option(paths());
assertEquals(2, formatted.length);
assertEquals("--patch-module", formatted[0]);
assertEquals(toPlatformSpecific("my.module=\"src/foo.java:src/bar.java\""), formatted[1]);
assertEquals(toPlatformSpecific("my.module=src/foo.java:src/bar.java"), formatted[1]);
}

/**
Expand Down
Loading