You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/05/12 22:05:00 UTC
[jira] [Commented] (THRIFT-3089) Assigning default ENUM values
results in non-compilable java code if java namespace is not defined
[ https://issues.apache.org/jira/browse/THRIFT-3089?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14540614#comment-14540614 ]
ASF GitHub Bot commented on THRIFT-3089:
----------------------------------------
GitHub user mreve opened a pull request:
https://github.com/apache/thrift/pull/490
Stopped adding period before enum name unless namespace is provided
Using the example from issue's description:
IDL file contains:
```
struct Params {
1: optional Color bColor = Color.BLACK;
}
```
Compiled to java (no namespace):
```
public Params() {
this.bColor = .Color.BLACK;
}
```
How it looks like with namespace `enumtest`:
```
public Params() {
this.bColor = enumtest.Color.BLACK;
}
```
This fix prevents adding the period sign when there's no java namespacec provided in the IDL file.
Compare:
https://issues.apache.org/jira/browse/THRIFT-3089
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/mreve/thrift THRIFT-3089
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/thrift/pull/490.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #490
----
commit ea51c05a5a2ad5b983089a1efb838a1a57e68fea
Author: Anna Dymek <aa...@gmail.com>
Date: 2015-05-12T19:54:20Z
Stopped adding period before enum name unless namespace is provided
----
> Assigning default ENUM values results in non-compilable java code if java namespace is not defined
> --------------------------------------------------------------------------------------------------
>
> Key: THRIFT-3089
> URL: https://issues.apache.org/jira/browse/THRIFT-3089
> Project: Thrift
> Issue Type: Bug
> Components: Java - Compiler
> Affects Versions: 0.9.2
> Reporter: Pavan Chitumalla
>
> enumtest.thrift file contents:
> ==============
> enum Color {
> BLACK = 5,
> WHITE = 6
> }
> struct Params {
> 1: optional Color bColor = Color.BLACK;
> }
> Running thrift --gen java enumtest.thrift (thrift 0.9.2 on OSX 10.10.3)
> results in non-compilable java code.
> public Params() {
> this.bColor = .Color.BLACK;
> }
> @Override
> public void clear() {
> this.bColor = .Color.BLACK;
> }
> Notice the "." before Color.BLACK. If java namespace is defined in the thrift file, it works as expected.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)