Copilot commented on code in PR #361:
URL: 
https://github.com/apache/maven-shared-utils/pull/361#discussion_r2751210435


##########
src/main/java/org/apache/maven/shared/utils/StringUtils.java:
##########
@@ -553,7 +553,9 @@ public static String[] split(@Nonnull String str, @Nullable 
String separator, in
      *
      * @param array the array of values to concatenate.
      * @return the concatenated string.
+     * @deprecated use <code>java.lang.String.join(</code>) instead

Review Comment:
   The suggested replacement with String.join() is potentially misleading. The 
StringUtils.concatenate() method accepts Object[] (varargs) and calls 
toString() on each element, while String.join() requires CharSequence elements. 
This means String.join() is not a drop-in replacement for cases where 
non-CharSequence objects are passed. 
   
   Consider clarifying the deprecation message to indicate that elements should 
be converted to strings first, or suggest using a stream-based approach like: 
Arrays.stream(array).map(Object::toString).collect(Collectors.joining(""))
   
   This is particularly important since the method signature explicitly accepts 
Object... array, suggesting it was designed to handle non-string objects.



##########
src/main/java/org/apache/maven/shared/utils/StringUtils.java:
##########
@@ -553,7 +553,9 @@ public static String[] split(@Nonnull String str, @Nullable 
String separator, in
      *
      * @param array the array of values to concatenate.
      * @return the concatenated string.
+     * @deprecated use <code>java.lang.String.join(</code>) instead
      */
+    @Deprecated
     @Nonnull
     public static String concatenate(@Nonnull Object... array) {

Review Comment:
   The PR description states "fixes #349", but issue #349 is titled "Deprecate 
StringUtils.clean" and describes the clean method, not the concatenate method 
being deprecated here. The clean method is already deprecated (line 74-76 of 
this file). This appears to be a mismatch between the PR description and the 
actual changes. Please verify whether this PR should reference a different 
issue, or if the PR description needs to be corrected.



##########
src/main/java/org/apache/maven/shared/utils/StringUtils.java:
##########
@@ -553,7 +553,9 @@ public static String[] split(@Nonnull String str, @Nullable 
String separator, in
      *
      * @param array the array of values to concatenate.
      * @return the concatenated string.
+     * @deprecated use <code>java.lang.String.join(</code>) instead

Review Comment:
   The deprecation message has a malformed HTML code tag. The opening 
parenthesis is inside the code tag but the closing parenthesis is outside it, 
making it read as "java.lang.String.join(" followed by ") instead". Based on 
other deprecation patterns in this file (lines 210, 460, 475, 502, 574, 605), 
the message should either be: 
   - "use {@code java.lang.String.join()}" (using {@code} format without <code> 
tags)
   - "use <code>java.lang.String.join()</code>" (with both parentheses inside 
the tag)
   
   The current format with the unmatched parenthesis is inconsistent and will 
not render correctly in generated documentation.



-- 
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]

Reply via email to