Skip to content

Commit

Permalink
Fix #1102
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 29, 2016
1 parent ae85620 commit 21a2e4b
Show file tree
Hide file tree
Showing 14 changed files with 233 additions and 109 deletions.
4 changes: 4 additions & 0 deletions release-notes/CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -401,3 +401,7 @@ Hugo Wood (hgwood@github)
Julian Hyde (julianhyde@github)
* Reported #1083: Field in base class is not recognized, when using `@JsonType.defaultImpl`
(2.7.1)

Thibault Kruse (tkruse@github)
* Reported #1102: Handling of deprecated `SimpleType.construct()` too minimalistic
(2.7.1)
2 changes: 2 additions & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Project: jackson-databind
#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)
#1102: Handling of deprecated `SimpleType.construct()` too minimalistic
(reported by Thibault K)

2.7.0 (10-Jan-2016)

Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/fasterxml/jackson/databind/JavaType.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ public JavaType forcedNarrowBy(Class<?> subclass)
return result;
}

@Deprecated // since 2.7
protected abstract JavaType _narrow(Class<?> subclass);

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public ArrayType withStaticTyping() {
* it is not even allowed.
*/
@Override
@Deprecated // since 2.7
protected JavaType _narrow(Class<?> subclass) {
return _reportUnsupported();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.fasterxml.jackson.databind.type;

import java.lang.reflect.TypeVariable;
import java.util.Collection;

import com.fasterxml.jackson.databind.JavaType;
Expand Down Expand Up @@ -59,8 +60,16 @@ public static CollectionLikeType construct(Class<?> rawType, TypeBindings bindin
*/
@Deprecated // since 2.7
public static CollectionLikeType construct(Class<?> rawType, JavaType elemT) {
return new CollectionLikeType(rawType, null,
// !!! TODO: wrong, probably has super-types, but:
// First: may need to fabricate TypeBindings (needed for refining into
// concrete collection types, as per [databind#1102])
TypeVariable<?>[] vars = rawType.getTypeParameters();
TypeBindings bindings;
if ((vars == null) || (vars.length != 1)) {
bindings = TypeBindings.emptyBindings();
} else {
bindings = TypeBindings.create(rawType, elemT);
}
return new CollectionLikeType(rawType, bindings,
_bogusSuperClass(rawType), null,
elemT, null, null, false);
}
Expand All @@ -81,6 +90,7 @@ public static CollectionLikeType upgradeFrom(JavaType baseType, JavaType element
}

@Override
@Deprecated // since 2.7
protected JavaType _narrow(Class<?> subclass) {
return new CollectionLikeType(subclass, _bindings,
_superClass, _superInterfaces, _elementType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.fasterxml.jackson.databind.type;

import java.lang.reflect.TypeVariable;

import com.fasterxml.jackson.databind.JavaType;

/**
Expand Down Expand Up @@ -44,13 +46,22 @@ public static CollectionType construct(Class<?> rawType, TypeBindings bindings,
*/
@Deprecated // since 2.7
public static CollectionType construct(Class<?> rawType, JavaType elemT) {
// nominally component types will be just Object.class
return new CollectionType(rawType, null,
// First: may need to fabricate TypeBindings (needed for refining into
// concrete collection types, as per [databind#1102])
TypeVariable<?>[] vars = rawType.getTypeParameters();
TypeBindings bindings;
if ((vars == null) || (vars.length != 1)) {
bindings = TypeBindings.emptyBindings();
} else {
bindings = TypeBindings.create(rawType, elemT);
}
return new CollectionType(rawType, bindings,
// !!! TODO: Wrong, does have supertypes, but:
_bogusSuperClass(rawType), null, elemT,
null, null, false);
}

@Deprecated // since 2.7
@Override
protected JavaType _narrow(Class<?> subclass) {
return new CollectionType(subclass, _bindings,
Expand Down
Loading

0 comments on commit 21a2e4b

Please sign in to comment.