This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch join
in repository https://gitbox.apache.org/repos/asf/maven-jlink-plugin.git

commit fb07aff7ae436a881d58ccd9d4acec5d4f3b6bb7
Author: Elliotte Rusty Harold <elh...@ibiblio.org>
AuthorDate: Tue Dec 3 07:15:59 2024 -0500

    Inline one line utility
---
 .../java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java    | 8 --------
 src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java       | 8 ++++----
 .../org/apache/maven/plugins/jlink/AbstractJLinkMojoTest.java     | 4 ++--
 3 files changed, 6 insertions(+), 14 deletions(-)

diff --git 
a/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java 
b/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java
index c99ac2f..a594fd8 100644
--- a/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java
+++ b/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java
@@ -202,12 +202,4 @@ public abstract class AbstractJLinkMojo extends 
AbstractMojo {
         return String.join(Character.toString(File.pathSeparatorChar), 
modulePaths);
     }
 
-    /**
-     * Convert a list into a
-     * @param modules The list of modules.
-     * @return The string with the module list which is separated by {@code ,}.
-     */
-    protected String getCommaSeparatedList(Collection<String> modules) {
-        return String.join(",", modules);
-    }
 }
diff --git a/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java 
b/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
index 9c00684..fde9356 100644
--- a/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
+++ b/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
@@ -706,7 +706,7 @@ public class JLinkMojo extends AbstractJLinkMojo {
 
         if (hasLimitModules()) {
             jlinkArgs.add("--limit-modules");
-            String sb = getCommaSeparatedList(limitModules);
+            String sb = String.join(",", limitModules);
             jlinkArgs.add(sb);
         }
 
@@ -714,7 +714,7 @@ public class JLinkMojo extends AbstractJLinkMojo {
             jlinkArgs.add("--add-modules");
             // This must be name of the module and *NOT* the name of the
             // file! Can we somehow pre check this information to fail early?
-            String sb = getCommaSeparatedList(modulesToAdd);
+            String sb = String.join(",", modulesToAdd);
             jlinkArgs.add(sb.replace("\\", "\\\\"));
         }
 
@@ -722,7 +722,7 @@ public class JLinkMojo extends AbstractJLinkMojo {
             jlinkArgs.add("--add-modules");
             jlinkArgs.add("jdk.localedata");
             jlinkArgs.add("--include-locales");
-            String sb = getCommaSeparatedList(includeLocales);
+            String sb = String.join(",", includeLocales);
             jlinkArgs.add(sb);
         }
 
@@ -744,7 +744,7 @@ public class JLinkMojo extends AbstractJLinkMojo {
         // NOTE: suggestProviders is a terminal JlinkTask, so must be at the 
end!
         if (hasSuggestProviders()) {
             jlinkArgs.add("--suggest-providers");
-            String sb = getCommaSeparatedList(suggestProviders);
+            String sb = String.join(",", suggestProviders);
             jlinkArgs.add(sb);
         }
 
diff --git 
a/src/test/java/org/apache/maven/plugins/jlink/AbstractJLinkMojoTest.java 
b/src/test/java/org/apache/maven/plugins/jlink/AbstractJLinkMojoTest.java
index fc82183..184b219 100644
--- a/src/test/java/org/apache/maven/plugins/jlink/AbstractJLinkMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/jlink/AbstractJLinkMojoTest.java
@@ -116,14 +116,14 @@ public class AbstractJLinkMojoTest {
     @Test
     @DisplayName("getCommaSeparatedList() should return a single character")
     public void getCommaSeparatedListShouldReturnASingleCharacter() {
-        String result = 
mojoMock.getCommaSeparatedList(Collections.singletonList("A"));
+        String result = String.join( ",", Collections.singletonList( "A" ) );
         assertThat(result).isEqualTo("A");
     }
 
     @Test
     @DisplayName("getCommaSeparatedList() should return two characters 
separated by comma")
     public void 
getCommaSeparatedListShouldReturnTwoCharactersSeparatedByComma() {
-        String result = mojoMock.getCommaSeparatedList(Arrays.asList("A", 
"B"));
+        String result = String.join( ",", Arrays.asList( "A", "B" ) );
         assertThat(result).isEqualTo("A,B");
     }
 }

Reply via email to