Skip to content

Commit 7be07c9

Browse files
do not strip generic type from Class (#3445)
Co-authored-by: judas <[email protected]>
1 parent 39885e7 commit 7be07c9

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/main/java/com/fasterxml/jackson/databind/type/TypeFactory.java

-11
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,6 @@ public class TypeFactory // note: was final in 2.9, removed from 2.10
104104
*/
105105
protected final static SimpleType CORE_TYPE_ENUM = new SimpleType(CLS_ENUM);
106106

107-
/**
108-
* Cache {@link Class} because it is nominally parametric, but has no really
109-
* useful information.
110-
*
111-
* @since 2.7
112-
*/
113-
protected final static SimpleType CORE_TYPE_CLASS = new SimpleType(CLS_CLASS);
114-
115107
/**
116108
* Cache {@link JsonNode} because it is no critical path of simple tree model
117109
* reading and does not have things to override
@@ -1594,9 +1586,6 @@ protected JavaType _fromParamType(ClassStack context, ParameterizedType ptype,
15941586
if (rawType == CLS_COMPARABLE) {
15951587
return CORE_TYPE_COMPARABLE;
15961588
}
1597-
if (rawType == CLS_CLASS) {
1598-
return CORE_TYPE_CLASS;
1599-
}
16001589

16011590
// First: what is the actual base type? One odd thing is that 'getRawType'
16021591
// returns Type, not Class<?> as one might expect. But let's assume it is

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

+11
Original file line numberDiff line numberDiff line change
@@ -660,4 +660,15 @@ public void testRawMapType()
660660
assertNotNull(type);
661661
assertEquals(Wrapper1297.class, type.getRawClass());
662662
}
663+
664+
// for [databind#3443]
665+
public void testParameterizedClassType() {
666+
TypeFactory tf = TypeFactory.defaultInstance();
667+
668+
JavaType t = tf.constructType(new TypeReference<Class<? extends CharSequence>>() { });
669+
670+
assertEquals(SimpleType.class, t.getClass());
671+
assertEquals(1, t.containedTypeCount());
672+
assertEquals(CharSequence.class, t.containedType(0).getRawClass());
673+
}
663674
}

0 commit comments

Comments
 (0)