[ https://issues.apache.org/jira/browse/GROOVY-10362?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-10362. ------------------------------ > STC reports an unexpected method ambiguity > ------------------------------------------ > > Key: GROOVY-10362 > URL: https://issues.apache.org/jira/browse/GROOVY-10362 > Project: Groovy > Issue Type: Bug > Components: Static Type Checker > Reporter: Thodoris Sotiropoulos > Assignee: Eric Milles > Priority: Minor > > This is an extremely complicated test case that it may be quite rare to > appear in practice. > I have the following piece of code > {code:java} > interface I<W, Y, B extends W> { > Y m(Y x, B y); > } > interface I2<S extends Boolean, M> extends I<S, S, S> {} > interface I3<J> extends I2<Boolean, J> {} > interface I4<X extends Number> extends I3<X> {} > class B implements I4<Number> { > public Boolean m(Boolean x, Boolean y) { > return false; > } > } > abstract class C<T1 extends Integer, T2 extends T1> extends B {} > public class Test { > void test() { > B x = bar(); > x.m(true, false); > } > C<Integer, Integer> bar() { > return null; > } > } > {code} > h3. Actual behaviour > {code} > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > test.groovy: 24: [Static type checking] - Reference to method is ambiguous. > Cannot choose between [java.lang.Boolean B#m(java.lang.Boolean, > java.lang.Boolean), Y I#m(Y, B)] > @ line 24, column 5. > x.m(true, false); > ^ > 1 error > {code} > h3. Expected behaviour > Compile successfully > NOTE: To trigger the bug, a four-leveled inheritance chain is required. Also, > class `D` needs to be abstract. If you change one of those, the code compiles > successfully. > Tested against master. -- This message was sent by Atlassian Jira (v8.20.10#820010)