Skip to content

Commit 892b99a

Browse files
committed
Simplest reproducer
1 parent 1102005 commit 892b99a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/test/java/com/fasterxml/jackson/databind/ser/GenericTypeSerializationTest.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,28 @@ public GG second() {
370370
}
371371
}
372372

373+
public static class SimpleWrapper<T> {
374+
375+
private final T value;
376+
377+
SimpleWrapper(T value) {
378+
this.value = value;
379+
}
380+
381+
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
382+
public static <T> SimpleWrapper<T> fromJson(JsonSimpleWrapper<T> value) {
383+
return new SimpleWrapper<>(value.object);
384+
}
385+
}
386+
387+
@JsonDeserialize
388+
public static final class JsonSimpleWrapper<T> {
389+
390+
@JsonProperty("object")
391+
public T object;
392+
393+
}
394+
373395
/*
374396
/**********************************************************
375397
/* Unit tests
@@ -521,4 +543,12 @@ public void testStaticDelegateDeserialization_wildcardInResult() throws Exceptio
521543
Account account2 = wrapper.second();
522544
assertEquals(new Account("name2", 2L), account2);
523545
}
546+
547+
public void testSimpleStaticJsonCreator() throws Exception
548+
{
549+
SimpleWrapper<Account> wrapper = MAPPER.readValue("{\"object\":{\"id\":1,\"name\":\"name1\"}}",
550+
new TypeReference<SimpleWrapper<Account>>() {});
551+
Account account = wrapper.value;
552+
assertEquals(new Account("name1", 1L), account);
553+
}
524554
}

0 commit comments

Comments
 (0)