[
https://issues.apache.org/jira/browse/GROOVY-10682?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17611741#comment-17611741
]
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_r984914990
##########
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java:
##########
@@ -7549,84 +7195,44 @@ public static <T> IntRange getIndices(T[] self) {
return new IntRange(false, 0, self.length);
}
- /**
- * Returns indices of the boolean array.
- *
- * @see #getIndices(Object[])
- * @since 3.0.8
- */
+ @Deprecated
public static IntRange getIndices(boolean[] self) {
- return new IntRange(false, 0, self.length);
+ return ArrayGroovyMethods.getIndices(self);
}
- /**
- * Returns indices of the byte array.
- *
- * @see #getIndices(Object[])
- * @since 3.0.8
- */
+ @Deprecated
public static IntRange getIndices(byte[] self) {
- return new IntRange(false, 0, self.length);
+ return ArrayGroovyMethods.getIndices(self);
}
- /**
- * Returns indices of the char array.
- *
- * @see #getIndices(Object[])
- * @since 3.0.8
- */
+ @Deprecated
public static IntRange getIndices(char[] self) {
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.getIndices(self)", 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)