Let's say I have a method with a generic parameter:
public <U> void genericMethod(U param) {
// doStuff
}
I also have two classes, one of which extends the other:
public class A {}
public class B extends A {}
And I do this:
A var = new B();
genericMethod(var);
In genericMethod, what is the type of U?
The variable I passed genericMethod is declared as A, but is actually B, so is U of type A or B?
I've tried testing it but I can't find a way to get information on U at runtime.