Consider an entity definition:
@Value.Immutable
@Value.Style(stagedBuilder = true)
@JsonDeserialize(as = ImmutableEntity.class)
public interface Entity {
@Value.Default
default String getNullableDefault() {
return "default";
}
}
and a JSON string: {"nullableDefault":null}
This would fail jackson deserialisation with:
Can not construct instance of org.immutables.fixture.jackson.ImmutableEntity, problem: nullableDefault
at [Source: {"nullableDefault":null}; line: 1, column: 40]
at org.immutables.fixture.jackson.ObjectMappedTest.jsonNullableWithDefault(ObjectMappedTest.java:252)
Caused by: java.lang.NullPointerException: nullableDefault
at org.immutables.fixture.jackson.ObjectMappedTest.jsonNullableWithDefault(ObjectMappedTest.java:252)
If you remove @Value.Style serialization works as expected.
Consider an entity definition:
and a JSON string:
{"nullableDefault":null}This would fail jackson deserialisation with:
If you remove
@Value.Styleserialization works as expected.