Skip to content

Commit

Permalink
Fixed #1302
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jul 16, 2016
1 parent 2d2f0c7 commit 11b1323
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Project: jackson-databind
with two static factory methods fail by default
#1297: Deserialization of generic type with Map.class
(reported by Arek G)
#1302: NPE for `ResolvedRecursiveType` in 2.8.0 due to caching

2.8.0 (04-Jul-2016)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,11 @@ public String toString() {
public boolean equals(Object o) {
if (o == this) return true;
if (o == null) return false;
if (o.getClass() != getClass()) return false;

return ((ResolvedRecursiveType) o).getSelfReferencedType().equals(getSelfReferencedType());
// Do NOT ever match unresolved references
if (_referencedType == null) {
return false;
}
return (o.getClass() == getClass()
&& _referencedType.equals(((ResolvedRecursiveType) o).getSelfReferencedType()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ protected JavaType _narrow(Class<?> subclass)
// Should we check that there is a sub-class relationship?
// 15-Jan-2016, tatu: Almost yes, but there are some complications with
// placeholder values (`Void`, `NoClass`), so can not quite do yet.
// TODO: fix in 2.8
// TODO: fix in 2.9
if (!_class.isAssignableFrom(subclass)) {
/*
throw new IllegalArgumentException("Class "+subclass.getName()+" not sub-type of "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,8 @@ else if (superClass != null) {
}
}
context.resolveSelfReferences(result);
// 16-Jul-2016, tatu: [databind#1302] is solved different way, but ideally we shouldn't
// cache anything with partially resolved `ResolvedRecursiveType`... so maybe improve
if (!result.hasHandlers()) {
_typeCache.putIfAbsent(key, result); // cache object syncs
}
Expand Down

0 comments on commit 11b1323

Please sign in to comment.