You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Duru Can Celasun (Jira)" <ji...@apache.org> on 2019/10/18 21:31:00 UTC
[jira] [Resolved] (THRIFT-4932) Using a default string on a binary
field results in invalid Java code.
[ https://issues.apache.org/jira/browse/THRIFT-4932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Duru Can Celasun resolved THRIFT-4932.
--------------------------------------
Fix Version/s: 0.13.0
Resolution: Fixed
> Using a default string on a binary field results in invalid Java code.
> ----------------------------------------------------------------------
>
> Key: THRIFT-4932
> URL: https://issues.apache.org/jira/browse/THRIFT-4932
> Project: Thrift
> Issue Type: Bug
> Components: Java - Compiler
> Affects Versions: 0.9.3, 0.12.0
> Reporter: Ewan Higgs
> Priority: Major
> Fix For: 0.13.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Given the following service definition:
> {code}
> $ cat Service.thrift
> service MyService {
> string doWork(
> 1: string arg1;
> 2: binary arg2 = '';
> 3: binary arg3 = '';
> );
> }
> {code}
> And the following compilation:
> {code}
> /usr/local/Cellar/thrift/0.12.0/bin/thrift -gen java Service.thrift
> {code}
> Results in code that does not compile. This is because we end up with code like the following:
> {code}
> public doWork_args() {
> this.arg2 = "";
> this.arg3 = "";
> }
> {code}
> In Java you cannot set a {{ByteBuffer}} to a {{String}} value.
> Users can run into this situation if they were generating C++ code before ({{binary}} and {{string}} both resolve to {{std::string}}) and then only later decide to use Java with existing files.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)