Can not use enum consts from included file as default value #47

Closed
erikvanoosten opened this Issue Mar 14, 2013 · 0 comments

Projects

None yet

2 participants

Contributor

It is not possible to use enum constants as default value when the enum is imported from another file.

For example, when I change $/scrooge-generator/src/test/thrift/relative/candy.thrift to:

struct Candy {
  1: i32 sweetness_iso
  2: CandyType candy_type = CandyType.WEIRD   // <---- added default
  3: string headline = include1.HEADLINE
  4: optional string brand = include2.BRAND
  5: i32 count = include3.PIECES
}

You get compilation errors in both Java and Scala output. Here is the Java output:

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] $/scrooge-generator/target/test-sources/thrift/java_test2/Candy.java:[50,53] cannot find symbol
symbol  : variable CandyType
location: class thrift.java_test2.Candy.Builder
[ERROR] $/scrooge-generator/target/test-sources/thrift/java_test2/Candy.java:[60,24] cannot find symbol
symbol  : variable CandyType
location: class thrift.java_test2.Candy.Builder
[ERROR] $/scrooge-generator/target/test-sources/thrift/java_test2/Candy.java:[131,46] cannot find symbol
symbol: variable CandyType
      thrift.java_test1.CandyType candyType = CandyType.WEIRD;

Here is the wrong java code:

private thrift.java_test1.CandyType _candyType = CandyType.WEIRD;

As you can see the type is missing on the right hand side (but not on the left hand side).

For Scala its the same problem.

@erikvanoosten erikvanoosten added a commit to marktplaats-external/scrooge that referenced this issue Mar 14, 2013
@erikvanoosten erikvanoosten solves #47: Support fields with an enum constant that is included fro…
…m another thrift file.
a6deb68
@erikvanoosten erikvanoosten added a commit to marktplaats-external/scrooge that referenced this issue Mar 15, 2013
@erikvanoosten erikvanoosten solves #47: Support fields with an enum constant that is included fro…
…m another thrift file.
caafd99
@chunyan chunyan closed this Mar 19, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment