The generic type class is not available at run time, i.e. T.class doesn't make sense.
Generic types are translated to Object at compilation time. This is called Type Erasure .
If you really need a class type argument, you need to add this as an argument:
public abstract class Model <T> { public static <T> T find(Class<T> clazz, int id) { T result = (T) blackMagicMethod(clazz, id); return result; } }
source share