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

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.9.3, 0.10.0
    • None
    • Java - Compiler
    • 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

        Issue Links

          Activity

            People

              Unassigned Unassigned
              anton.batylin Anton Batylin
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h