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:23:00 UTC

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

    [ https://issues.apache.org/jira/browse/THRIFT-5141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17060002#comment-17060002 ] 

dongjin2193.jeon commented on THRIFT-5141:
------------------------------------------

this problem also occured in tupleSchemeReadValue.

> 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
>            Priority: Major
>
> 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)