[
https://issues.apache.org/jira/browse/GROOVY-10682?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17611740#comment-17611740
]
ASF GitHub Bot commented on GROOVY-10682:
-----------------------------------------
sonatype-lift[bot] commented on code in PR #1785:
URL: https://github.com/apache/groovy/pull/1785#discussion_r984914845
##########
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java:
##########
@@ -6803,116 +6521,44 @@ public static <T> String join(T[] self, String
separator) {
return join(new ArrayIterator<>(self), separator);
}
- /**
- * Concatenates the string representation of each
- * items in this array, with the given String as a separator between each
- * item.
- *
- * @param self an array of boolean
- * @param separator a String separator
- * @return the joined String
- * @since 2.4.1
- */
+ @Deprecated
public static String join(boolean[] self, String separator) {
- return join(new BooleanArrayIterator(self), separator);
+ return ArrayGroovyMethods.join(self, separator);
}
- /**
- * Concatenates the string representation of each
- * items in this array, with the given String as a separator between each
- * item.
- *
- * @param self an array of byte
- * @param separator a String separator
- * @return the joined String
- * @since 2.4.1
- */
+ @Deprecated
public static String join(byte[] self, String separator) {
- return join(new ByteArrayIterator(self), separator);
+ return ArrayGroovyMethods.join(self, separator);
}
- /**
- * Concatenates the string representation of each
- * items in this array, with the given String as a separator between each
- * item.
- *
- * @param self an array of char
- * @param separator a String separator
- * @return the joined String
- * @since 2.4.1
- */
+ @Deprecated
public static String join(char[] self, String separator) {
Review Comment:
*[InlineMeSuggester](https://errorprone.info/bugpattern/InlineMeSuggester):*
This deprecated API looks inlineable. If you'd like the body of the API to be
inlined to its callers, please annotate it with @InlineMe.
---
```suggestion
@InlineMe(replacement = "ArrayGroovyMethods.join(self, separator)",
imports = "org.codehaus.groovy.runtime.ArrayGroovyMethods")
```
---
<details><summary><b>ℹ️ Learn about @sonatype-lift commands</b></summary>
You can reply with the following commands. For example, reply with
***@sonatype-lift ignoreall*** to leave out all findings.
| **Command** | **Usage** |
| -----------
> Provide eachWithIndex for primitive arrays
> ------------------------------------------
>
> Key: GROOVY-10682
> URL: https://issues.apache.org/jira/browse/GROOVY-10682
> Project: Groovy
> Issue Type: Improvement
> Components: groovy-jdk
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Minor
>
> Consider the following:
> {code:groovy}
> @groovy.transform.TypeChecked
> void test(int[] ints) {
> ints.eachWithIndex { value, index ->
> println "$index: ${value.doubleValue()}"
> }
> }
> test(0,1,2,3,4,5)
> {code}
> Compiler reports "[Static type checking] - Cannot find matching method
> java.lang.Object#doubleValue()"
> {{eachWithIndex}} is only provided for reference types, so "value" is seen as
> Object by the type checker.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)