This is a well-known problem with Java type erasure: T is just a type variable, and you must indicate actual class, usually as Class argument. Without such information, best that can be done is to use bounds; and plain T is roughly same as 'T extends Object'. And Jackson will then bind JSON Objects as Maps.
In this case, tester method needs to have access to Class, and you can construct
JavaType type = mapper.getTypeFactory().
List<Foo> list = mapper.readValue(new File("input.json"), type);
It works : I did the following: JavaType topMost = mapper.getTypeFactory().constructParametricType(MyWrapper.class, ActualClassRuntime.class); and then did the readValue and it finally worked :)
Yes, that does work -- thanks for pointing out the method for creating generic type other than Map/Collection type!
@StaxMan would it better to use ClassMate for these kind of things from now?
@husayt yes, technically java-classmate lib is superior. But integrating it with Jackson is bit tricky just because Jackson's own type abstraction is integrated part of API. For long term it'd be great to figure out proper way to make Jackson use classmate code, either embedded or via dep.