Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.

Commit 5853863

Browse files
committed
1 parent 496e591 commit 5853863

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializer.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,6 @@ protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p, Deseri
947947
p.setCurrentValue(bean);
948948
// if so, need to copy all remaining tokens into buffer
949949
while (t == JsonToken.FIELD_NAME) {
950-
p.nextToken(); // to skip name
951950
tokens.copyCurrentStructure(p);
952951
t = p.nextToken();
953952
}

src/test/java/com/fasterxml/jackson/databind/deser/TestBasicAnnotations.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,32 @@ final static class SizeClassSetter3
6161
@JsonDeserialize public void x(int value) { _x = value; }
6262
}
6363

64+
static class Issue2088Bean {
65+
int x;
66+
int y;
67+
68+
@JsonUnwrapped
69+
Issue2088UnwrappedBean w;
70+
71+
public Issue2088Bean(@JsonProperty("x") int x, @JsonProperty("y") int y) {
72+
this.x = x;
73+
this.y = y;
74+
}
75+
76+
public void setW(Issue2088UnwrappedBean w) {
77+
this.w = w;
78+
}
79+
}
80+
81+
static class Issue2088UnwrappedBean {
82+
int a;
83+
int b;
84+
85+
public Issue2088UnwrappedBean(@JsonProperty("a") int a, @JsonProperty("b") int b) {
86+
this.a = a;
87+
this.b = b;
88+
}
89+
}
6490

6591
/// Classes for testing Setter discovery with inheritance
6692
static class BaseBean
@@ -181,6 +207,16 @@ public void testIssue442PrivateUnwrapped() throws Exception
181207
assertEquals(5, bean.w.i);
182208
}
183209

210+
// [databind#2088]
211+
public void testIssue2088UnwrappedFieldsAfterLastCreatorProp() throws Exception
212+
{
213+
Issue2088Bean bean = MAPPER.readValue("{\"x\":1,\"a\":2,\"y\":3,\"b\":4}", Issue2088Bean.class);
214+
assertEquals(1, bean.x);
215+
assertEquals(2, bean.w.a);
216+
assertEquals(3, bean.y);
217+
assertEquals(4, bean.w.b);
218+
}
219+
184220
/*
185221
/**********************************************************
186222
/* Test methods, annotations disabled

0 commit comments

Comments
 (0)