I have an interface, parametrized by <V> and would like to pass the type parameter to a method like this:
public interface MyInterface<V extends BaseClass> {
<T> T myGenericMethod(Class<T> clazz);
default void run() {
...
String s = ((BaseClass) myGenericMethod(V)).getStringValue(); // <- V can not be resolved to a variable
...
}
}
As a workaround I use now method, returning the class, which I'd like to avoid:
Class<?> getType();