You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Bryan Duxbury (JIRA)" <ji...@apache.org> on 2010/11/03 01:08:27 UTC

[jira] Updated: (THRIFT-864) default value fails if identifier is a struct

     [ https://issues.apache.org/jira/browse/THRIFT-864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury updated THRIFT-864:
---------------------------------

    Fix Version/s: 0.6

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