|
11 | 11 | import com.fasterxml.jackson.core.JsonProcessingException; |
12 | 12 | import com.fasterxml.jackson.core.type.TypeReference; |
13 | 13 |
|
14 | | -import com.fasterxml.jackson.databind.DeserializationContext; |
15 | | -import com.fasterxml.jackson.databind.JavaType; |
16 | | -import com.fasterxml.jackson.databind.ObjectMapper; |
17 | | -import com.fasterxml.jackson.databind.SerializerProvider; |
| 14 | +import com.fasterxml.jackson.databind.*; |
18 | 15 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; |
19 | 16 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
20 | 17 | import com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer; |
21 | 18 | import com.fasterxml.jackson.databind.ser.std.StdScalarSerializer; |
22 | | -import com.fasterxml.jackson.databind.type.TypeBindings; |
23 | 19 | import com.fasterxml.jackson.databind.type.TypeFactory; |
24 | 20 |
|
25 | 21 | public class OptionalTest extends ModuleTestBase |
@@ -256,17 +252,15 @@ public void testOtherRefSerializers() throws Exception |
256 | 252 | public void testTypeResolution() throws Exception |
257 | 253 | { |
258 | 254 | // Should be able to construct using parametric `constructType()` |
| 255 | + // 19-Oct-2020, tatu: should not try to use TypeBindings, use different |
| 256 | + // method |
259 | 257 | final TypeFactory tf = MAPPER.getTypeFactory(); |
260 | | - JavaType t = tf.constructType(Optional.class, TypeBindings.create(Optional.class, new JavaType[] { |
261 | | - tf.constructType(Set.class, TypeBindings.create(Set.class, new JavaType[] { |
262 | | - tf.constructType(Integer.class) |
263 | | - })) |
264 | | - })); |
| 258 | + JavaType t = tf.constructType(Optional.class); |
265 | 259 | assertEquals(Optional.class, t.getRawClass()); |
266 | 260 | assertTrue(t.isReferenceType()); |
| 261 | + // without parameterization, defaults to `java.lang.Object` |
267 | 262 | JavaType t2 = t.getReferencedType(); |
268 | | - assertEquals(Set.class, t2.getRawClass()); |
269 | | - assertTrue(t2.isCollectionLikeType()); |
| 263 | + assertEquals(Object.class, t2.getRawClass()); |
270 | 264 |
|
271 | 265 | // as well as: |
272 | 266 | t = tf.constructParametricType(Optional.class, |
|
0 commit comments