I have the following code:
public class Pair< T, U > {
public T first;
public U second;
}
public class Test {
public int method( Pair< Integer, Integer > pair ) {
return 0;
}
public double method( Pair< Double, Double > pair ) {
return 1.0;
}
}
This actually compiles and works like one would expect. But if the return types are made to be the same, this doesn't compile, with the expected "name clash: method(Pair) and method(Pair) have the same erasure"
Given that the return type isn't part of the method signature, how is this overloading possible?