I have a POJO defined as follows:
@Value
public class Abc {
@NonNull
private final String id;
@NonNull
private final Integer id2;
@NonNull
private final List<String> data;
@NonNull
private final String otherData;
}
When I am doing,
GSON.fromJson(str, Abc.class);
with str as:
{
"id": "dsada",
"id2": 12,
"data": ["dsadsa"]
}
In this, there is no otherData field. Even then, GSON.fromJson is not failing. Why is it so? Then, is there any significance of marking the field as @NonNull?