Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1920 Binary Type
  3. THRIFT-1035

Container types containing binary data are parameterized with ByteBuffer in the generated Java code

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 0.4, 0.5, 0.6, 0.7
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      All

      Description

      Since THRIFT-830, binary fields are internally handled using ByteBuffer.

      Release 0.4.0 was the first to expose the ByteBuffer to the outside world (replacing previous methods returning/accepting byte[]).

      THRIFT-882 lead to the methods accepting/returning byte[] being available again, as it was deemed more reasonable not to expose the ByteBuffer too much as their use could be cumbersome. This lead to 0.5.0 being backward compatible with 0.3.0 on the binary fields front.

      During that time, nobody noticed that container types that contained binary data had their generated Java code changed to collections parameterized with ByteBuffer instead of byte[].

      list<binary> -> List<ByteBuffer>
      set<binary> -> Set<ByteBuffer>
      map<binary,...> -> Map<ByteBuffer,...>
      map<...,binary> -> Map<...,ByteBuffer>

      This introduces confusion in the API and still exposes ByteBuffer when discussion on THRIFT-882 concluded this should be avoided.

      We need to provide a way to offer the original parameterization with byte[] as this will simplify working with that type of collection and thus will increase the odds of Thrift's adoption.

        Attachments

        1. THRIFT-1035-2.patch
          17 kB
          Mathias Herberts
        2. THRIFT-1035.patch
          15 kB
          Mathias Herberts

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              herberts Mathias Herberts
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: