Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
0.9.3, 0.12.0
-
None
Description
Given the following service definition:
$ cat Service.thrift service MyService { string doWork( 1: string arg1; 2: binary arg2 = ''; 3: binary arg3 = ''; ); }
And the following compilation:
/usr/local/Cellar/thrift/0.12.0/bin/thrift -gen java Service.thrift
Results in code that does not compile. This is because we end up with code like the following:
public doWork_args() { this.arg2 = ""; this.arg3 = ""; }
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.
Attachments
Issue Links
- duplicates
-
THRIFT-234 Can't assign binary fields default values
- Closed
- links to