Possible Duplicate:
Create instance of generic type in Java?
I only found out that Java doesn't let you construct new instances of generic type arguments after trying to write this:
public static <C extends JSONSerializable> List<C> JSONtoList(JSONArray data) {
List<C> list = new ArrayList<C>();
for (int i = 0; i < data.length(); i++){
list.add(new C(data.get(i)));
}
return list;
}
This doesn't compile, but I think its obvious what I'm trying to do. How can I do it?