Thodoris Sotiropoulos created GROOVY-11106:
----------------------------------------------

             Summary: 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


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