Example:
class Controller {
@GET
public Collection<MyClass> getCollection {
return Arrays.<MyClass>asList(new SubclassOfMyClass())
}
}
class MyClass {
public getA() {
...
}
}
class SubclassOfMyClass extends MyClass {
public getB() {
...
}
}
When used with Jersey's JacksonFeature, JSON returned will only contain attribute A and not attribute B because static serialisation of the root type is forced and there is no way I can override that. If, however, I wrap the collection with some other non-generic type, then static serialisation will not be forced and I will get both attribute "a" and "b" in the JSON produced by this GET.
jackson-jaxrs-base version used is 2.5.4.
Issue originally reported against Jersey but they are inclined to blame jackson: https://java.net/jira/browse/JERSEY-2939.