Skip to content

Commit 7ee69be

Browse files
committed
Add test for FasterXML#1647
1 parent 1a0326f commit 7ee69be

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/test/java/com/fasterxml/jackson/databind/type/RecursiveTypeTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ static class HashTree<K, V> extends HashMap<K, HashTree<K, V>> { }
1313
// for [databind#938]
1414
public static interface Ability<T> { }
1515

16+
// for [databind#1647]
17+
static interface IFace<T> {}
18+
19+
// for [databind#1647]
20+
static class Base implements IFace<Sub> { }
21+
22+
// for [databind#1647]
23+
static class Sub extends Base { }
24+
1625
public static final class ImmutablePair<L, R> implements Map.Entry<L, R>, Ability<ImmutablePair<L, R>> {
1726
public final L key;
1827
public final R value;
@@ -93,4 +102,14 @@ public void testJavaTypeToString() throws Exception
93102
fail("Description should contain 'recursive type', did not: "+desc);
94103
}
95104
}
105+
106+
// for [databind#1647]
107+
public void testSuperClassWithReferencedJavaType() {
108+
TypeFactory tf = objectMapper().getTypeFactory();
109+
tf.constructType(Base.class); // must be constructed before sub to set the cache correctly
110+
JavaType subType = tf.constructType(Sub.class);
111+
// baseTypeFromSub should be a ResolvedRecursiveType in this test
112+
JavaType baseTypeFromSub = subType.getSuperClass();
113+
assertNotNull(baseTypeFromSub.getSuperClass());
114+
}
96115
}

0 commit comments

Comments
 (0)