(note: follow-up on #2105)
So: it looks like NON_DEFAULT value for Boolean -- for example -- is new Boolean(false) (similar to the default of false for primitive boolean). But this does not really make sense: for non-primitive types, default should be null.
NOTE: this is different from Class-level "Class member Default" which compares actual property values a POJO is initialized with, using default (no-args) Constructor.
Test case:
public class Test {
@Test
public void name() throws Exception {
ObjectMapper mapper = JsonMapper.builder()
.changeDefaultPropertyInclusion(incl -> incl.withValueInclusion(JsonInclude.Include.NON_DEFAULT))
.build();
Pojo pojo = new Pojo();
pojo.setValue(false);
System.out.println(mapper.writeValueAsString(pojo));
}
public static class Pojo {
private Boolean value;
public Boolean getValue() {
return value;
}
public void setValue(Boolean value) {
this.value = value;
}
}
with Jackson v 2.8.2 outputs {"value":false} (as I expected). This however changes starting with 2.8.3: it outputs {} (tested with 2.8.3, 2.8.11.2 and 2.9.6).
Default value for Boolean is null, not false.
EDIT: behavior will be controlled with a new MapperFeature.WRAPPERS_DEFAULT_TO_NULL -- planned to default to false in 3.1 (leaving existing 2.8.3 - 3.0.3 behavior as default).