Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-9072

Document Protobuf annotated collection null set callbacks

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Obsolete
    • Icon: Major Major
    • None
    • 9.2.1.Final
    • Documentation
    • None

      When using collection fields in Protobuf annotated classes, empty collections are marshalled into the same value as null, because Protobuf only has repeated fields and no fields is represented as null.

      This means that if you have an entity with an empty collection, when it's deserialized the collection will be null. This can be confusing for users and should be documented.

      anistor had some ideas on how to improve this:

      <anistor> I'm thinking of a way to make this easier for users that
          would prefer an empty collection being set instead of a
          null. would be possible by adding a new attribute for this in
          @ProtoField anotation
      > that'd be more predictable
      <anistor> would still not give you at deserializtion what was written
          during serialization. we do not have a null marker
      <anistor> it would just give you an empty collection if you prefer
      <anistor> instead of null
      > that option should be enabled by default
      

            Unassigned Unassigned
            rh-ee-galder Galder ZamarreƱo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: