[
https://issues.apache.org/jira/browse/GROOVY-10682?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17609668#comment-17609668
]
Felix Schnabel commented on GROOVY-10682:
-----------------------------------------
I searched through all the methods of {{DefaultGroovyMethods}} and found
following Methods that would all have their primitive type variants in the
ArrayGroovyMethods: any, asBoolean, asType, average, chop, collate, collect,
collectEntries, collectMany, contains, count, countBy, drop, dropRight,
dropWhile, each, eachByte, eachWithIndex, equals, every, find, findAll,
findIndexOf, findIndexValues, findLastIndexOf, findResult, findResults, first,
flatten, getAt, getIndices, grep, groupBy, head, indexed, init, inject,
iterator, join, last, max, min, minus, plus, reverse, reverseEach, shuffle,
shuffled, size, sort, split, sum, swap, tail, take, takeRight, takeWhile,
toArrayString, toList, toSet, toSorted, toSpreadMap, toString, toUnique,
transpose, union.
I got this list with this little script and afterwards removed duplicates and
alphabetize them:
{code:java}
Method[] methods = DefaultGroovyMethods.class.getMethods();
for (Method m : methods){
Class<?>[] params = m.getParameterTypes();
if(params.length != 0 && params[0].isArray()){
System.out.println(m.getName());
}
}
{code}
> 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)