Conversation
There was a problem hiding this comment.
Pull request overview
This PR deprecates the StringUtils.concatenate() method and suggests using Java's built-in String.join() method as a replacement. However, there is a discrepancy between the PR description (which references issue #349 about deprecating StringUtils.clean) and the actual changes (which deprecate StringUtils.concatenate).
Changes:
- Added
@Deprecatedannotation to theconcatenate(Object... array)method - Added
@deprecatedjavadoc tag suggestingString.join()as replacement
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * | ||
| * @param array the array of values to concatenate. | ||
| * @return the concatenated string. | ||
| * @deprecated use <code>java.lang.String.join(</code>) instead |
There was a problem hiding this 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
tags) - "use
java.lang.String.join()" (with both parentheses inside the tag)
The current format with the unmatched parenthesis is inconsistent and will not render correctly in generated documentation.
| * | ||
| * @param array the array of values to concatenate. | ||
| * @return the concatenated string. | ||
| * @deprecated use <code>java.lang.String.join(</code>) instead |
There was a problem hiding this 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.
|
@elharo Please assign appropriate label to PR according to the type of change. |
fixes #347