default value fails if identifier is a struct
---------------------------------------------
Key: THRIFT-864
URL: https://issues.apache.org/jira/browse/THRIFT-864
Project: Thrift
Issue Type: Bug
Components: Compiler (General)
Affects Versions: 0.4
Reporter: Stephen Haberman
The thrift IDL specifies that a field can be a assigned a default ConstValue,
which can be an identifier, possibly a struct. However, the compiler rejects
this input with the error: {{type error: const was declared as
struct/xception}}.
For this example input:
{code}
struct A {
1: string name = ""
}
const A DEFAULT_A = {}
struct B {
1: A a = DEFAULT_A
}
{code}
The expected output would be something like (in Java):
{code}
public class B {
public B() {
this.a = new A(Constants.DEFAULT_A);
}
}
{code}
Note that a copy of {{DEFAULT_A}} is used instead of the {{DEFAULT_A}} instance
itself.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.