Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Information Provided
-
None
-
None
Description
I have the following 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; } }
Actual behaviour
The code compiles successfully. The compiler resolves the second method, that is m(DataOutput).
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.