Is there a way to get Class object from the type variable in Java generic class? Something like that:
public class Bar extends Foo<T> {
public Class getParameterClass() {
return T.class; // doesn't compile
}
}
This type information is available at compile time and therefore should not be affected by type erasure, so, theoretically, there should be a way to accomplish this. Does it exist?