-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Milestone
Description
(note: follow-up to #2821)
Looks like there are some problems with passing of type resolution context in case of "raw" references to generic types, something like:
class Generic<T> {
public Map value;
}
where in resolution is attempted for raw Map
(expressed as Class<?>
and not GenericType
); type resolver gets confused.
Full reproduction provided in #2821 by @MartinTeeVarga is as follows:
static class GenericEntity<T> {
T field;
Map map;
public void setField(T field) {
this.field = field;
}
public T getField() {
return field;
}
public Map getMap() {
return map;
}
public void setMap(Map map) {
this.map = map;
}
}
static class SimpleEntity {
Integer number;
public void setNumber(Integer number) {
this.number = number;
}
public Integer getNumber() {
return number;
}
}
public void testTypeRefinementIssue() throws Exception {
ObjectMapper m = new ObjectMapper();
final String JSON = "{ \"field\": { \"number\": 1 }, \"map\": { \"key\": \"value\" } }";
GenericEntity<SimpleEntity> genericEntity = m.readValue(JSON,
new TypeReference<GenericEntity<SimpleEntity>>() {});
assertNotNull(genericEntity);
}
Metadata
Metadata
Assignees
Labels
No labels