Open jansupol opened 6 years ago
@m0mus Commented It's an error in javadoc. It should say:
In case of true, fields will not be serialized (default behaviour).
The general rule is that smaller scope annotation takes precedence over the bigger scope annotation. So , it you case @JsonbProperty on field overrides @JsonbNillable on type.
Quoting from Javadoc of annotation
JsonbNillable
:This sounds as if the default value of the annotation is false. However, the actual default value is true:
Maybe the "default behaviour" refers to property serialization when no
JsonbNillable
annotation is present at class level, but this is rather confusing to the reader.Moreover, it is not quite clear which of
JsonbNillable
andJsonbProperty
takes precedence. Consider this example:Running a test with Yasson shows that the
nillable = false
default ofJsonbProperty
takes precedence over the class level annotation. This complies with Section 4.3 of the spec, but this behaviour cannot be gathered from the Javadoc of the two annotation classes.