[ https://issues.apache.org/jira/browse/GROOVY-11121?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-11121. ------------------------------ > unexpected error when having overloaded methods, one of which receiving an > Iterable > ----------------------------------------------------------------------------------- > > Key: GROOVY-11121 > URL: https://issues.apache.org/jira/browse/GROOVY-11121 > Project: Groovy > Issue Type: Bug > Components: Static Type Checker > Reporter: Thodoris Sotiropoulos > Assignee: Eric Milles > Priority: Minor > Labels: overloading > Fix For: 5.0.0-alpha-5 > > > I have the following program > {code} > import java.util.function.*; > class Foo<T> { > static <T> Foo<T> of(Iterable<T> values) { return null; } > static <T> Foo<T> of(T values) { return null; } > } > class Main { > static final void test() { > Foo.<IntUnaryOperator>of((int s) -> s + 1); > } > } > {code} > h3. Actual behavior > {code} > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > Main.groovy: 10: [Static type checking] - Wrong number of parameters for > method target: iterator() > @ line 10, column 38. > var x = Foo.<IntUnaryOperator>of((int s) -> s + 1); > ^ > 1 error > {code} > h3. Expected behavior > Compile successfully > h3. Notes > Test case adapted from the following program that uses the apache-commons-io > library: > {code} > import org.apache.commons.io.function.*; > import java.util.function.*; > class Main { > static final void test() { > var x = IOStream.<IntUnaryOperator>of((int s) -> s + 1); > } > } > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)