I'm trying to solve a problem and I've come up with this solution (simplified):
package help;
public class Problem {
private static class A<T> {
public void foo(T t) {}
}
private static class B<T> {}
private static class C<T> extends A<B<T>> {
public void foo(T t) {}
}
}
It wont compile since "foo(T) in help.Problem.C clashes with foo(T) in help.Problem.A; both methods have same erasure, yet neither overrides the other".
I'm not just trying to solve the problem, i also would like to understand what is going on. I noticed that if the B class is omitted, the error is gone.
Also: could you provide an example of a piece of code such, that the compiler wouldn't be able to bind a variable to one of those two methods?