I am going through a problem when I call my generic static method, the type is not inferred. I don't have the type reference in the method arguments.
public static <K> K parseJsonToObject(String JsonString) {
Gson gson = new Gson();
K k = gson.fromJson(JsonString, new TypeToken<K>() {
}.getType());
return k;
}
and calling with
homeContent = JsonHelper.<HomeContent>parseJsonToObject(result);
and got the crash log
illegal type variable reference
need some help here. thanks