File tree 2 files changed +44
-4
lines changed
main/java/com/fasterxml/jackson/databind/jsontype/impl
test/java/com/fasterxml/jackson/failing
2 files changed +44
-4
lines changed Original file line number Diff line number Diff line change @@ -204,10 +204,9 @@ protected final JsonDeserializer<Object> _findDeserializer(DeserializationContex
204
204
205
205
protected final JsonDeserializer <Object > _findDefaultImplDeserializer (DeserializationContext ctxt ) throws IOException
206
206
{
207
- /* 06-Feb-2013, tatu: As per [databind#148], consider default implementation value of
208
- * {@link java.lang.Void} to mean "serialize as null"; as well as DeserializationFeature
209
- * to do swift mapping to null
210
- */
207
+ // 06-Feb-2013, tatu: As per [databind#148], consider default implementation value of
208
+ // {@link java.lang.Void} to mean "serialize as null"; as well as DeserializationFeature
209
+ // to do swift mapping to null
211
210
if (_defaultImpl == null ) {
212
211
if (!ctxt .isEnabled (DeserializationFeature .FAIL_ON_INVALID_SUBTYPE )) {
213
212
return NullifyingDeserializer .instance ;
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .failing ;
2
+
3
+ import com .fasterxml .jackson .annotation .JsonSubTypes ;
4
+ import com .fasterxml .jackson .annotation .JsonTypeInfo ;
5
+ import com .fasterxml .jackson .annotation .JsonTypeName ;
6
+
7
+ import com .fasterxml .jackson .databind .BaseMapTest ;
8
+ import com .fasterxml .jackson .databind .DeserializationFeature ;
9
+ import com .fasterxml .jackson .databind .ObjectMapper ;
10
+
11
+ public class PolymorphicEnum2775DeserTest extends BaseMapTest
12
+ {
13
+ // [databind#2775]
14
+ @ JsonTypeInfo (use = JsonTypeInfo .Id .NAME
15
+ // work-around:
16
+ // , include = JsonTypeInfo.As.WRAPPER_ARRAY
17
+ )
18
+ @ JsonSubTypes (@ JsonSubTypes .Type (TestEnum2775 .class ))
19
+ interface Base2775 {}
20
+
21
+ @ JsonTypeName ("Test" )
22
+ enum TestEnum2775 implements Base2775 {
23
+ VALUE ;
24
+ }
25
+
26
+ private final ObjectMapper MAPPER = newJsonMapper ();
27
+
28
+ // [databind#2775]
29
+ public void testIssue2775 () throws Exception
30
+ {
31
+ final Base2775 testValue = TestEnum2775 .VALUE ;
32
+ String json = MAPPER .writeValueAsString (testValue );
33
+ //System.err.println("JSON: "+json);
34
+
35
+ Base2775 deserializedValue = MAPPER .readerFor (Base2775 .class )
36
+ .without (DeserializationFeature .FAIL_ON_INVALID_SUBTYPE )
37
+ .readValue (json );
38
+ assertEquals (testValue , deserializedValue );
39
+ }
40
+
41
+ }
You can’t perform that action at this time.
0 commit comments