[
https://issues.apache.org/jira/browse/GROOVY-10682?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17609079#comment-17609079
]
Paul King commented on GROOVY-10682:
------------------------------------
Just a few more points:
* Depending on which methods you bring across, you might need to extend
{{{}DefaultGroovyMethodsSupport{}}}. Basically, if you need to use
{{normaliseIndex}} or {{{}subListBorders{}}}, you would extend that class. As
an example, if you brought across {{{}getAt(T[] self, Collection indices){}}},
it calls {{getAtImpl}} which uses {{{}normaliseIndex{}}}.
* Also, when "bringing across" methods to the new class, we'd leave the
original signature in place (usually with a changed body just calling the new
method) but mark the original signature as {{{}@Deprecated{}}}. Methods marked
that way are omitted from the collected extension methods but are still
available if anyone has precompiled code calling the original - maybe STC code
compiled with earlier Groovy versions and now on the classpath or maybe some
folks just called it explicitly.
* One of the places you would need to add a reference is here:
https://github.com/apache/groovy/blob/master/subprojects/groovy-binary/build.gradle#L42-L53
> 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)