You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Stephen Haberman (JIRA)" <ji...@apache.org> on 2010/08/23 23:54:17 UTC
[jira] Created: (THRIFT-864) default value fails if identifier is a
struct
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.
[jira] Updated: (THRIFT-864) default value fails if identifier is a
struct
Posted by "Stephen Haberman (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stephen Haberman updated THRIFT-864:
------------------------------------
Description:
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.
was:
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.
> 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.