I have a Java overload problem that I cannot understand.
The code is as follows:
private void f(Object o) {
}
private void f(Collection c) {
}
private <T> T dummy() {
return null;
}
private void g() {
f(dummy());
}
Now dummy () returns an object of type undefined, so erasing should result in an object type. However, calling f (dummy ()) actually calls f (Collection), not f (Object). Why is this so?
source
share