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

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
6bangs committed Jul 16, 2018
1 parent 496e591 commit 5853863
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,6 @@ protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p, Deseri
p.setCurrentValue(bean);
// if so, need to copy all remaining tokens into buffer
while (t == JsonToken.FIELD_NAME) {
p.nextToken(); // to skip name
tokens.copyCurrentStructure(p);
t = p.nextToken();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,32 @@ final static class SizeClassSetter3
@JsonDeserialize public void x(int value) { _x = value; }
}

static class Issue2088Bean {
int x;
int y;

@JsonUnwrapped
Issue2088UnwrappedBean w;

public Issue2088Bean(@JsonProperty("x") int x, @JsonProperty("y") int y) {
this.x = x;
this.y = y;
}

public void setW(Issue2088UnwrappedBean w) {
this.w = w;
}
}

static class Issue2088UnwrappedBean {
int a;
int b;

public Issue2088UnwrappedBean(@JsonProperty("a") int a, @JsonProperty("b") int b) {
this.a = a;
this.b = b;
}
}

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

// [databind#2088]
public void testIssue2088UnwrappedFieldsAfterLastCreatorProp() throws Exception
{
Issue2088Bean bean = MAPPER.readValue("{\"x\":1,\"a\":2,\"y\":3,\"b\":4}", Issue2088Bean.class);
assertEquals(1, bean.x);
assertEquals(2, bean.w.a);
assertEquals(3, bean.y);
assertEquals(4, bean.w.b);
}

/*
/**********************************************************
/* Test methods, annotations disabled
Expand Down

0 comments on commit 5853863

Please sign in to comment.