Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4086

Java compiler generates different meta data depending on order of structures in file

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 0.9.3, 0.10.0
    • Fix Version/s: None
    • Component/s: Java - Compiler
    • Labels:
      None

      Description

      When compiling th following thrift code:

      struct Customer {
        1:  required i32         customer_id,
        2:  required list<Order> orders
      }
      
      struct Order {
        1:  required i32         order_id,
      }
      

      compiler generates meta data for orders field as FieldValueMetaData:

      tmpMap.put(_Fields.ORDERS, new org.apache.thrift.meta_data.FieldMetaData("orders", org.apache.thrift.TFieldRequirementType.REQUIRED, 
              new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
                  new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT            , "Order"))));
      

      If structs order is reversed:

      struct Order {
        1:  required i32         order_id,
      }
      
      struct Customer {
        1:  required i32         customer_id,
        2:  required list<Order> orders
      }
      

      compiler generates meta data for orders field as StructMetaData:

      tmpMap.put(_Fields.ORDERS, new org.apache.thrift.meta_data.FieldMetaData("orders", org.apache.thrift.TFieldRequirementType.REQUIRED, 
              new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
                  new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Order.class))));
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              anton.batylin Anton Batylin
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: