In MessageJsonAdapter#fromJson, we ignore null values with if (value == null) continue. But if the deserialized value is a List<T?> whose some element is null, we still call fieldBinding.set(builder, value).
Later, when the T message is built, immutableCopyOf("…", list) checks require(null !in result) and throws an IllegalArgumentException because the list contains a null entry.
Is it okay to open a PR that updates fromJson to skip lists where every element is null, or to only include non-null elements?
EDIT: I initially thought we could simply remove nulls, but there are cases—like repeated google.protobuf.NullValue—where null is officially permitted.
In
MessageJsonAdapter#fromJson, we ignore null values withif (value == null) continue. But if the deserialized value is aList<T?>whose some element is null, we still callfieldBinding.set(builder, value).Later, when the
Tmessage is built,immutableCopyOf("…", list)checksrequire(null !in result)and throws an IllegalArgumentException because the list contains a null entry.Is it okay to open a PR that updatesfromJsonto skip lists where every element is null, or to only include non-null elements?EDIT: I initially thought we could simply remove nulls, but there are cases—like
repeated google.protobuf.NullValue—where null is officially permitted.