[ 
https://issues.apache.org/jira/browse/GROOVY-11106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17736123#comment-17736123
 ] 

Paul King commented on GROOVY-11106:
------------------------------------

This is part of the current method selection algorithm which favours interfaces 
over classes. It perhaps lacks a more formal justification/specification.

> Failed to detect an ambiguous method call?
> ------------------------------------------
>
>                 Key: GROOVY-11106
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11106
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Thodoris Sotiropoulos
>            Priority: Minor
>              Labels: overloading
>
> I have the following code:
> {code}
> import java.io.*;
> import java.util.*;
> class Main {
>   void test() {
>     ObjectOutputStream y = null;
>     m(y); 
>   }
>   Number m(OutputStream x) { return 1; }
>   Number m(DataOutput x) { return 2; }
> }
> {code}
> h3. Actual behaviour
> The code compiles successfully. The compiler resolves the second method, that 
> is m(DataOutput).
> h3. Expected behaviour
> It seems that the method call is ambiguous, and thus the compiler should have 
> rejected the above program. javac seems to reject the program with a method 
> ambiguity error. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to