thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anton Batylin (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (THRIFT-4086) Java compiler generates different meta data depending on order of structures in file
Date Mon, 13 Feb 2017 07:37:41 GMT

     [ https://issues.apache.org/jira/browse/THRIFT-4086?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Anton Batylin updated THRIFT-4086:
----------------------------------
    Description: 
When compiling th following thrift code:
{quote}
struct Customer {{
  1:  required i32         customer_id,
  2:  required list<Order> orders
}}

struct Order {
  1:  required i32         order_id,
}
{quote}
compiler generates meta data for {{orders}} field as {{FieldValueMetaData}}:
{quote}
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"))));
{quote}

If structs order is reversed:
{quote}
struct Order {
  1:  required i32         order_id,
}

struct Customer {
  1:  required i32         customer_id,
  2:  required list<Order> orders
}
{quote}
compiler generates meta data for {{orders}} field as {{StructMetaData}}:
{quote}
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))));
{quote}

  was:
When compiling th following thrift code:
{quote}
struct Customer {
  1:  required i32         customer_id,
  2:  required list<Order> orders
}

struct Order {
  1:  required i32         order_id,
}
{quote}
compiler generates meta data for {{orders}} field as {{FieldValueMetaData}}:
{quote}
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"))));
{quote}

If structs order is reversed:
{quote}
struct Order {
  1:  required i32         order_id,
}

struct Customer {
  1:  required i32         customer_id,
  2:  required list<Order> orders
}
{quote}
compiler generates meta data for {{orders}} field as {{StructMetaData}}:
{quote}
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))));
{quote}


> Java compiler generates different meta data depending on order of structures in file
> ------------------------------------------------------------------------------------
>
>                 Key: THRIFT-4086
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4086
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Compiler
>    Affects Versions: 0.9.3, 0.10.0
>            Reporter: Anton Batylin
>
> When compiling th following thrift code:
> {quote}
> struct Customer {{
>   1:  required i32         customer_id,
>   2:  required list<Order> orders
> }}
> struct Order {
>   1:  required i32         order_id,
> }
> {quote}
> compiler generates meta data for {{orders}} field as {{FieldValueMetaData}}:
> {quote}
> 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"))));
> {quote}
> If structs order is reversed:
> {quote}
> struct Order {
>   1:  required i32         order_id,
> }
> struct Customer {
>   1:  required i32         customer_id,
>   2:  required list<Order> orders
> }
> {quote}
> compiler generates meta data for {{orders}} field as {{StructMetaData}}:
> {quote}
> 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))));
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message