Calling a method with an arg of Class<T> where T is a parameterized type
- by Brian Ferris
I'm attempting to call a constructor method that looks like:
public static SomeWrapper<T> method(Class<T> arg);
When T is an unparameterized type like String or Integer, calling is straightforward:
SomeWrapper<String> wrapper = method(String.class);
Things get tricky when T is a parameterized type like List<String>. …