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

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

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

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

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            dongjin2193 dongjin2193.jeon

            Dates

              Created:
              Updated:

              Slack

                Issue deployment