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

Order of struct and enum affect generation results

    XMLWordPrintableJSON

    Details

    • Type: Question
    • Status: Closed
    • Priority: Major
    • Resolution: Information Provided
    • Affects Version/s: 0.9.3
    • Fix Version/s: None
    • Component/s: Compiler (General)
    • Labels:
      None

      Description

      The following thrift IDL produce generation error

      namespace java com.mishadoff.sample
      
      struct Request {
        1: optional Mode mode = Mode.APPEND
      }
      
      enum Mode {
        APPEND = 1
        OVERWRITE = 2
      }
      
      [FAILURE:/Users/mkoz/temp/enum_order.thrift:5] No enum value or constant found named "Mode.APPEND"!
      

      However, if you put enum before struct it compiles fine. Should order of structs or enums impact the compilation process?

      namespace java com.mishadoff.sample
      
      enum Mode {
        APPEND = 1
        OVERWRITE = 2
      }
      
      struct Request {
        1: optional Mode mode = Mode.APPEND
      }
      

        Attachments

          Activity

            People

            • Assignee:
              jking3 James E. King III
              Reporter:
              mishadoff Mykhailo Kozik
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: