Closed
Description
See the following code example.
@Immutable
@JsonSerialize(as = ImmutableSimpleTest.class)
@JsonDeserialize(as = ImmutableSimpleTest.class)
public interface SimpleTest {
@Default
default Optional<String> getString() {
return Optional.empty();
}
@Default
default Optional<JsonNode> getJsonNode() {
return Optional.empty();
}
static void main(String[] args) throws IOException {
final ObjectMapper objectMapper = new ObjectMapper().registerModule(new Jdk8Module());
SimpleTest simpleTest = ImmutableSimpleTest.builder().build();
final SimpleTest deserialized = objectMapper.readValue(objectMapper.writeValueAsBytes(simpleTest), SimpleTest.class);
System.out.println(simpleTest);
System.out.println(deserialized);
}
}
When using jackson-databind
2.10.0 and jackson-datatype-jdk8
2.9.10 with immutables value
2.8.1 the code works as expected: deserialized
equals simpleTest
.
When using jackson-datatype-jdk8
2.10.0, the two values are no longer equal. The deserialized JsonNode is Optional[null]
rather than Optional.empty
.
Metadata
Metadata
Assignees
Labels
No labels