[
https://issues.apache.org/jira/browse/THRIFT-864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Carl Yeksigian closed THRIFT-864.
---------------------------------
Resolution: Won't Fix
> 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
> Fix For: 1.0
>
>
> 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.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira