You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "dongjin2193.jeon (Jira)" <ji...@apache.org> on 2020/03/16 07:12:00 UTC

[jira] [Created] (THRIFT-5141) thrift writes malformed java codes when generating union with "reuse-objects" option

dongjin2193.jeon created THRIFT-5141:
----------------------------------------

             Summary: thrift writes malformed java codes when generating union with "reuse-objects" option
                 Key: THRIFT-5141
                 URL: https://issues.apache.org/jira/browse/THRIFT-5141
             Project: Thrift
          Issue Type: Bug
          Components: Java - Compiler
    Affects Versions: 0.9.3
            Reporter: dongjin2193.jeon


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:java}
// 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);
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)