[
https://issues.apache.org/jira/browse/GROOVY-11106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17797293#comment-17797293
]
Eric Milles commented on GROOVY-11106:
--------------------------------------
https://docs.groovy-lang.org/latest/html/documentation/#_method_selection_algorithm
> 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)