Skip to content

Commit 77789ab

Browse files
committed
Minor tweak over #3950
1 parent 234b9ad commit 77789ab

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public class TypeFactory // note: was final in 2.9, removed from 2.10
9999
private final static Class<?> CLS_JSON_NODE = JsonNode.class; // since 2.10
100100

101101
private final static Class<?> CLS_BOOL = Boolean.TYPE;
102+
private final static Class<?> CLS_DOUBLE = Double.TYPE;
102103
private final static Class<?> CLS_INT = Integer.TYPE;
103104
private final static Class<?> CLS_LONG = Long.TYPE;
104105

@@ -110,6 +111,7 @@ public class TypeFactory // note: was final in 2.9, removed from 2.10
110111

111112
// note: these are primitive, hence no super types
112113
protected final static SimpleType CORE_TYPE_BOOL = new SimpleType(CLS_BOOL);
114+
protected final static SimpleType CORE_TYPE_DOUBLE = new SimpleType(CLS_DOUBLE);
113115
protected final static SimpleType CORE_TYPE_INT = new SimpleType(CLS_INT);
114116
protected final static SimpleType CORE_TYPE_LONG = new SimpleType(CLS_LONG);
115117

@@ -1401,6 +1403,7 @@ protected JavaType _findWellKnownSimple(Class<?> clz) {
14011403
if (clz == CLS_BOOL) return CORE_TYPE_BOOL;
14021404
if (clz == CLS_INT) return CORE_TYPE_INT;
14031405
if (clz == CLS_LONG) return CORE_TYPE_LONG;
1406+
if (clz == CLS_DOUBLE) return CORE_TYPE_DOUBLE;
14041407
} else {
14051408
if (clz == CLS_STRING) return CORE_TYPE_STRING;
14061409
if (clz == CLS_OBJECT) return CORE_TYPE_OBJECT; // since 2.7
@@ -1621,13 +1624,13 @@ protected JavaType _fromWellKnownClass(ClassStack context, Class<?> rawType, Typ
16211624
if (BaseStream.class.isAssignableFrom(rawType)) {
16221625
if (DoubleStream.class.isAssignableFrom(rawType)) {
16231626
return _iterationType(rawType, bindings, superClass, superInterfaces,
1624-
constructType(Double.class));
1627+
CORE_TYPE_DOUBLE);
16251628
} else if (IntStream.class.isAssignableFrom(rawType)) {
16261629
return _iterationType(rawType, bindings, superClass, superInterfaces,
1627-
constructType(Integer.class));
1630+
CORE_TYPE_INT);
16281631
} else if (LongStream.class.isAssignableFrom(rawType)) {
16291632
return _iterationType(rawType, bindings, superClass, superInterfaces,
1630-
constructType(Long.class));
1633+
CORE_TYPE_LONG);
16311634
}
16321635
}
16331636
return null;

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,13 +319,13 @@ public void testIterationTypesDirect() throws Exception
319319
_verifyIteratorType(tf.constructType(new TypeReference<Stream<Long>>() { }),
320320
Stream.class, Long.class);
321321

322-
// Then numeric typed:
322+
// Then primitive stream:
323323
_verifyIteratorType(tf.constructType(DoubleStream.class),
324-
DoubleStream.class, Double.class);
324+
DoubleStream.class, Double.TYPE);
325325
_verifyIteratorType(tf.constructType(IntStream.class),
326-
IntStream.class, Integer.class);
326+
IntStream.class, Integer.TYPE);
327327
_verifyIteratorType(tf.constructType(LongStream.class),
328-
LongStream.class, Long.class);
328+
LongStream.class, Long.TYPE);
329329
}
330330

331331
// for [databind#3950]: resolve `Iterator`, `Stream`

0 commit comments

Comments
 (0)