Skip to content

Commit

Permalink
Backport #761 fix in 2.5(.3)
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Apr 21, 2015
1 parent ae10786 commit 3470803
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions release-notes/CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ Dylan Scott (dylanscott@github)
issue)
(2.5.2)

Alexey Gavrilov (Alexey1Gavrilov@github)
* Reported, contributed fix for #761: Builder deserializer: in-compatible type exception
when return type is super type
(2.5.3)

Dmitry Spikhalskiy (Spikhalskiy@github)
* Reported #731, suggested the way to fix it: XmlAdapter result marshaling error in
case of ValueType=Object
Expand Down
2 changes: 2 additions & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Project: jackson-databind
(reported by migel@github)
#745: EnumDeserializer.deserializerForCreator fails when used to deserialize a Map key
(contributed by John M)
#761: Builder deserializer: in-compatible type exception when return type is super type
(contributed by Alexey G)

2.5.2 (29-Mar-2015)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,13 @@ public JsonDeserializer<?> buildBuilderBased(JavaType valueType,
}
// also: type of the method must be compatible
Class<?> rawBuildType = _buildMethod.getRawReturnType();
if (!valueType.getRawClass().isAssignableFrom(rawBuildType)) {
Class<?> rawValueType = valueType.getRawClass();
if ((rawBuildType != rawValueType)
&& !rawBuildType.isAssignableFrom(rawValueType)
&& !rawValueType.isAssignableFrom(rawBuildType)) {
throw new IllegalArgumentException("Build method '"+_buildMethod.getFullName()
+" has bad return type ("+rawBuildType.getName()
+"), not compatible with POJO type ("+valueType.getRawClass().getName()+")");
+" has bad return type ("+rawBuildType.getName()
+"), not compatible with POJO type ("+valueType.getRawClass().getName()+")");
}
// And if so, we can try building the deserializer
Collection<SettableBeanProperty> props = _properties.values();
Expand Down

0 comments on commit 3470803

Please sign in to comment.