Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
erikvanoosten opened this Issue · 0 comments

2 participants

@erikvanoosten

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 referenced this issue from a commit in marktplaats-external/scrooge
@erikvanoosten erikvanoosten solves #47: Support fields with an enum constant that is included fro…
…m another thrift file.
a6deb68
@erikvanoosten erikvanoosten referenced this issue from a commit in marktplaats-external/scrooge
@erikvanoosten erikvanoosten solves #47: Support fields with an enum constant that is included fro…
…m another thrift file.
caafd99
@chunyan chunyan closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.