I have a static method which will return a custom type based on the type of the class,
public class GenericMethod {
    public static <T> T returnGeneric(Class<T> clazz) {
        return null;
    }
}
Now, I want to pass a class with a generic type in to it,
CustomType<String> type = GenericMethod.returnGeneric(CustomType.class);
Only problem is that the above statement gives and unchecked conversion warning.
I tried the workaround new CustomType<String>().getName() which is also not solving the problem.
Is there a right way to it, or the only solution is to use @SuppressWarnings ?
 
     
     
     
    