Skip to content

Commit

Permalink
Fix #1083
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 16, 2016
1 parent d5e12f7 commit dbf0c6f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
4 changes: 4 additions & 0 deletions release-notes/CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -397,3 +397,7 @@ Shumpei Akai (flexfrank@github)
Hugo Wood (hgwood@github)
* Contributed #1010: Support for array delegator
(2.7.0)

Julian Hyde (julianhyde@github)
* Reported #1083: Field in base class is not recognized, when using `@JsonType.defaultImpl`
(2.7.1)
2 changes: 2 additions & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project: jackson-databind
2.7.1 (not yet released)

#1079: Add back `TypeFactory.constructType(Type, Class)` as "deprecated" in 2.7.1
#1083: Field in base class is not recognized, when using `@JsonType.defaultImpl`
(reported by Julian H)

2.7.0 (10-Jan-2016)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ protected TypeDeserializerBase(JavaType baseType, TypeIdResolver idRes,
// 22-Dec-2015, tatu: as per [databind#1055], avoid NPE
_typePropertyName = (typePropertyName == null) ? "" : typePropertyName;
_typeIdVisible = typeIdVisible;
// defaults are fine, although concurrency of 4 bit more frugal than 16:
_deserializers = new ConcurrentHashMap<String, JsonDeserializer<Object>>(16, 0.75f, 4);
// defaults are fine, although shouldn't need much concurrency
_deserializers = new ConcurrentHashMap<String, JsonDeserializer<Object>>(16, 0.75f, 2);
if (defaultImpl == null) {
_defaultImpl = null;
} else {
Expand All @@ -84,6 +84,8 @@ protected TypeDeserializerBase(JavaType baseType, TypeIdResolver idRes,
* seldom (if ever) base types, may be ok.
*/
// 01-Nov-2015, tatu: Actually this is still exactly wrong. Should fix.
// 15-Jan-2016, tatu: ... as witnessed by [databind#1083], patched, but
// fundamentally this call can't be made to work for all cases
_defaultImpl = baseType.forcedNarrowBy(defaultImpl);
}
_property = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,16 @@ protected JavaType _narrow(Class<?> subclass)
return this;
}
// Should we check that there is a sub-class relationship?
return new SimpleType(subclass, _bindings, _superClass, _superInterfaces,
// 15-Jan-2016, tatu: Almost yes, but there are some complications with
// placeholder values, so no.
/*
if (!_class.isAssignableFrom(subclass)) {
throw new IllegalArgumentException("Class "+subclass.getName()+" not sub-type of "
+_class.getName());
}
*/
// 15-Jan-2015, tatu: Not correct; should really re-resolve...
return new SimpleType(subclass, _bindings, this, _superInterfaces,
_valueHandler, _typeHandler, _asStatic);
}

Expand Down

0 comments on commit dbf0c6f

Please sign in to comment.