diff --git a/release-notes/CREDITS b/release-notes/CREDITS index 7bd5b91e19..96d20ea5cf 100644 --- a/release-notes/CREDITS +++ b/release-notes/CREDITS @@ -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) diff --git a/release-notes/VERSION b/release-notes/VERSION index d0bda25a8b..706160a70c 100644 --- a/release-notes/VERSION +++ b/release-notes/VERSION @@ -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) diff --git a/src/main/java/com/fasterxml/jackson/databind/jsontype/impl/TypeDeserializerBase.java b/src/main/java/com/fasterxml/jackson/databind/jsontype/impl/TypeDeserializerBase.java index 57952007f2..bcd35e2b5f 100644 --- a/src/main/java/com/fasterxml/jackson/databind/jsontype/impl/TypeDeserializerBase.java +++ b/src/main/java/com/fasterxml/jackson/databind/jsontype/impl/TypeDeserializerBase.java @@ -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>(16, 0.75f, 4); + // defaults are fine, although shouldn't need much concurrency + _deserializers = new ConcurrentHashMap>(16, 0.75f, 2); if (defaultImpl == null) { _defaultImpl = null; } else { @@ -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; diff --git a/src/main/java/com/fasterxml/jackson/databind/type/SimpleType.java b/src/main/java/com/fasterxml/jackson/databind/type/SimpleType.java index bd2ad0049d..1c741ec9fa 100644 --- a/src/main/java/com/fasterxml/jackson/databind/type/SimpleType.java +++ b/src/main/java/com/fasterxml/jackson/databind/type/SimpleType.java @@ -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); }