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

thrift writes malformed java codes when generating union with "reuse-objects" option

    XMLWordPrintableJSON

    Details

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

      Description

      I ran thrfit  command with options "--gen java:reuse-objects" .

      As a result a variable was generated with no initializing.

      There are sample codes bellow.

      I got a compile error that "error: variable put might not have been initialized" 

      // code placeholder
      @Override
       protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field) throws org.apache.thrift.TException {
       _Fields setField = _Fields.findByThriftId(field.id);
      if (setField != null) {
      switch (setField) {
      case PUT:
          if (field.type == PUT_FIELD_DESC.type) {
          TPut put;
          if (put == null) {
              put = new TPut();
          }
          put.read(iprot);
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dongjin2193 dongjin2193.jeon
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: