Gson desearilize list and class, how does erasure work here?
问题 I intend to write a generic method to convert a json list into it's specific list with class. This is the generic json parser: public class JsonParserUtils { private static Gson gson = new Gson(); public static <T> String toJson(T object) { if (object == null) { return null; } return gson.toJson(object); } public static <T> T fromJson(String json, Class<T> className) { if (StringUtils.isEmpty(json)) { return null; } T object = gson.fromJson(json, className); return object; } public static <T>