by zigzag312 on 2/6/25, 10:27 AM with 1 comments
by zigzag312 on 2/6/25, 10:27 AM
From what I gather, every field has a default value even, if it doesn't make sense for a specific field to have a default value. So, fields that can't have meaningful default values will always have a value, but the value might be "bad".
The issue is that analyzers doesn't warn you about a possibility of a bad value in a protobuf message, like they do for possible null values. It's up to a dev to remember to check hazzer for each such field to verify, if the value was explicitly set or not. Bugs where hazzer is not checked, when it should be, lead to silent data corruption.
EDIT: Also, checking if the field value was explicitly set is inconsistent in protobuf as collection fields (repeated & map) don't support presence tracking.