I'm trying to understand why the type erasure of this method doesn't work with wildcards.
public boolean foo(TypeA<TypeB<?>, TypeB<?>> bar) {
return true;
}
// instantiate an object
TypeA<TypeB<TypeC>, TypeB<TypeC>> somethingOtherThanFooBar = ...;
// TypeA<TypeB<?>, TypeB<?>> cannot be applied to TypeA<TypeB<TypeC>, TypeB<TypeC>>
foo(somethingOtherThanFooBar);
I know it will work if the method signature is pulic <T, U> boolean foo(TypeA<TypeB<T>, TypeB<U>> bar)
but this doesn't work with wildcards for a reason I'm failing to understand.