You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In case of false, fields will not be serialized (default behaviour).
This sounds as if the default value of the annotation is false. However, the actual default value is true:
boolean value() default 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 and JsonbProperty takes precedence. Consider this example:
@JsonbNillable
public void Foo {
@JsonbProperty("the_value")
private String theValue;
}
Running a test with Yasson shows that the nillable = false default of JsonbProperty 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.
The text was updated successfully, but these errors were encountered:
@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.The text was updated successfully, but these errors were encountered: