This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/master by this push:
new 1d75c4f0f7 Revert the quoting of filenames in
`JavaPathType.option(…)`. (#11435)
1d75c4f0f7 is described below
commit 1d75c4f0f76f95beb40b1359d502ec3a157efc60
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Thu Nov 13 15:20:26 2025 +0100
Revert the quoting of filenames in `JavaPathType.option(…)`. (#11435)
This is a partial revert of https://github.com/apache/maven/pull/2505
based on the observation that above PR has not been merged in 4.0.x.
For making the two branches consistent, we need to either port or revert
2505.
A revert is less disruptive as no Maven 4.1.x version has been released yet
and it would avoid https://github.com/apache/maven-compiler-plugin/pull/991.
---
.../src/main/java/org/apache/maven/api/JavaPathType.java | 6 ++++--
.../src/test/java/org/apache/maven/api/JavaPathTypeTest.java | 4 ++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git
a/api/maven-api-core/src/main/java/org/apache/maven/api/JavaPathType.java
b/api/maven-api-core/src/main/java/org/apache/maven/api/JavaPathType.java
index b2e98ed3c6..4762a40932 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/JavaPathType.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/JavaPathType.java
@@ -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,
@@ -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());
@@ -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,
diff --git
a/api/maven-api-core/src/test/java/org/apache/maven/api/JavaPathTypeTest.java
b/api/maven-api-core/src/test/java/org/apache/maven/api/JavaPathTypeTest.java
index 701a82775b..d05f860706 100644
---
a/api/maven-api-core/src/test/java/org/apache/maven/api/JavaPathTypeTest.java
+++
b/api/maven-api-core/src/test/java/org/apache/maven/api/JavaPathTypeTest.java
@@ -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]);
}
/**
@@ -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]);
}
/**