Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

branch 2.14 version of #4918 #4919

Draft
wants to merge 3 commits into
base: 2.14
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,24 @@ static class NestedBigDecimalHolder2784 {
public BigDecimalHolder2784 holder;
}

static class DeserializationIssue4917 {
public DecimalHolder4917 decimalHolder;
public Double number;
}

static class DecimalHolder4917 {
public BigDecimal value;

public DecimalHolder4917(BigDecimal value) {
this.value = value;
}

@JsonCreator
static DecimalHolder4917 of(BigDecimal value) {
return new DecimalHolder4917(value);
}
}

/*
/**********************************************************************
/* Helper classes, serializers/deserializers/resolvers
Expand Down Expand Up @@ -362,4 +380,14 @@ public void testBigDecimalUnwrapped() throws Exception
NestedBigDecimalHolder2784 result = mapper.readValue(JSON, NestedBigDecimalHolder2784.class);
assertEquals(new BigDecimal("5.00"), result.holder.value);
}

public void testBigDecimal4917() throws Exception
{
DeserializationIssue4917 issue = MAPPER.readValue(
a2q("{'decimalHolder':100.00,'number':50}"),
DeserializationIssue4917.class);
assertEquals(new BigDecimal("100.00"), issue.decimalHolder.value);
assertEquals(50.0, issue.number);
}

}
Loading