You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (JIRA)" <ji...@apache.org> on 2015/05/12 22:47:00 UTC

[jira] [Updated] (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:all-tabpanel ]

Jens Geyer updated THRIFT-3089:
-------------------------------
    Description: 
{code:title=enumtest.thrift}
==============
enum Color {
  BLACK = 5,
  WHITE = 6
}

struct Params {
  1: optional Color bColor = Color.BLACK;
}
{code}

Running thrift --gen java enumtest.thrift (thrift 0.9.2 on OSX 10.10.3)
results in non-compilable java code.

{code}
  public Params() {
    this.bColor = .Color.BLACK;

  }

  @Override
  public void clear() {
    this.bColor = .Color.BLACK;

  }
{code}

Notice the "." before Color.BLACK. If java namespace is defined in the thrift file, it works as expected.




  was:
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.





> 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
>
> {code:title=enumtest.thrift}
> ==============
> enum Color {
>   BLACK = 5,
>   WHITE = 6
> }
> struct Params {
>   1: optional Color bColor = Color.BLACK;
> }
> {code}
> Running thrift --gen java enumtest.thrift (thrift 0.9.2 on OSX 10.10.3)
> results in non-compilable java code.
> {code}
>   public Params() {
>     this.bColor = .Color.BLACK;
>   }
>   @Override
>   public void clear() {
>     this.bColor = .Color.BLACK;
>   }
> {code}
> 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)