You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Tony Kinnis (JIRA)" <ji...@apache.org> on 2010/09/10 01:55:32 UTC
[jira] Created: (THRIFT-895) Thrift compiler does not allow two
different enum's to have the same key name for one of the enum values
Thrift compiler does not allow two different enum's to have the same key name for one of the enum values
--------------------------------------------------------------------------------------------------------
Key: THRIFT-895
URL: https://issues.apache.org/jira/browse/THRIFT-895
Project: Thrift
Issue Type: Bug
Components: Compiler (General)
Affects Versions: 0.4
Reporter: Tony Kinnis
As of version 0.4.0 the Thrift compiler no longer allows two different enums to have a key with the same name. It seems that this change was introduced by the patch for THRIFT-544. Particularly the patch labeled: thrift-544_prevent_redefining_consts.patch.
The problem with this patch is that it now blocks this seemingly valid definition.
enum Foo {
A=1,
B=2
}
enum Bar {
A=1,
B=2
}
If I then run the thrift compiler as follows....
thrift --gen java test.thrift
It will tell me that: test.thrift:7] Enum A is already defined!
However, this should be valid and has worked in previous versions of Thrift. I believe this patch (thrift-544_prevent_redefining_consts.patch) should be rolled back.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-895) Thrift compiler does not allow two
different enumerations to have the same key name for one of the enum values
Posted by "Bruce Lowekamp (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908054#action_12908054 ]
Bruce Lowekamp commented on THRIFT-895:
---------------------------------------
For Erlang, again, it could be fixed, but the code right now generates:
-define{<service>_<key>,1}
for each key. so it would be simple to change it to
-define{<service>_<enum_name>_<key>, 1}
to get rid of the conflict, but all referencing code would have to change.
> Thrift compiler does not allow two different enumerations to have the same key name for one of the enum values
> --------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-895
> URL: https://issues.apache.org/jira/browse/THRIFT-895
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (General)
> Affects Versions: 0.4
> Reporter: Tony Kinnis
> Assignee: Bryan Duxbury
> Priority: Critical
> Fix For: 0.5
>
> Attachments: test.thrift
>
>
> As of version 0.4.0 the Thrift compiler no longer allows two different enums to have a key with the same name. It seems that this change was introduced by the patch for THRIFT-544. Particularly the patch labeled: thrift-544_prevent_redefining_consts.patch.
> The problem with this patch is that it now blocks this seemingly valid definition.
> enum Foo {
> A=1,
> B=2
> }
> enum Bar {
> A=1,
> B=2
> }
> If I then run the thrift compiler as follows....
> thrift --gen java test.thrift
> It will tell me that: test.thrift:7] Enum A is already defined!
> However, this should be valid and has worked in previous versions of Thrift. I believe this patch (thrift-544_prevent_redefining_consts.patch) should be rolled back.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-895) Thrift compiler does not allow two
different enumerations to have the same key name for one of the enum values
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908073#action_12908073 ]
Bryan Duxbury commented on THRIFT-895:
--------------------------------------
I'm sure that changing their code references would be an acceptable cost to those that are actually encountering this problem right now.
> Thrift compiler does not allow two different enumerations to have the same key name for one of the enum values
> --------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-895
> URL: https://issues.apache.org/jira/browse/THRIFT-895
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (General)
> Affects Versions: 0.4
> Reporter: Tony Kinnis
> Assignee: Bryan Duxbury
> Priority: Critical
> Fix For: 0.5
>
> Attachments: test.thrift
>
>
> As of version 0.4.0 the Thrift compiler no longer allows two different enums to have a key with the same name. It seems that this change was introduced by the patch for THRIFT-544. Particularly the patch labeled: thrift-544_prevent_redefining_consts.patch.
> The problem with this patch is that it now blocks this seemingly valid definition.
> enum Foo {
> A=1,
> B=2
> }
> enum Bar {
> A=1,
> B=2
> }
> If I then run the thrift compiler as follows....
> thrift --gen java test.thrift
> It will tell me that: test.thrift:7] Enum A is already defined!
> However, this should be valid and has worked in previous versions of Thrift. I believe this patch (thrift-544_prevent_redefining_consts.patch) should be rolled back.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (THRIFT-895) Thrift compiler does not allow two
different enumerations to have the same key name for one of the enum values
Posted by "Tony Kinnis (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-895?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tony Kinnis updated THRIFT-895:
-------------------------------
Summary: Thrift compiler does not allow two different enumerations to have the same key name for one of the enum values (was: Thrift compiler does not allow two different enum's to have the same key name for one of the enum values)
> Thrift compiler does not allow two different enumerations to have the same key name for one of the enum values
> --------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-895
> URL: https://issues.apache.org/jira/browse/THRIFT-895
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (General)
> Affects Versions: 0.4
> Reporter: Tony Kinnis
> Attachments: test.thrift
>
>
> As of version 0.4.0 the Thrift compiler no longer allows two different enums to have a key with the same name. It seems that this change was introduced by the patch for THRIFT-544. Particularly the patch labeled: thrift-544_prevent_redefining_consts.patch.
> The problem with this patch is that it now blocks this seemingly valid definition.
> enum Foo {
> A=1,
> B=2
> }
> enum Bar {
> A=1,
> B=2
> }
> If I then run the thrift compiler as follows....
> thrift --gen java test.thrift
> It will tell me that: test.thrift:7] Enum A is already defined!
> However, this should be valid and has worked in previous versions of Thrift. I believe this patch (thrift-544_prevent_redefining_consts.patch) should be rolled back.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (THRIFT-895) Thrift compiler does not allow two
different enumerations to have the same key name for one of the enum values
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-895?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bryan Duxbury closed THRIFT-895.
--------------------------------
Assignee: David Reiss (was: Bryan Duxbury)
Resolution: Fixed
Fixed by the attached patch and THRIFT-897.
> Thrift compiler does not allow two different enumerations to have the same key name for one of the enum values
> --------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-895
> URL: https://issues.apache.org/jira/browse/THRIFT-895
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (General)
> Affects Versions: 0.4
> Reporter: Tony Kinnis
> Assignee: David Reiss
> Priority: Critical
> Fix For: 0.5
>
> Attachments: test.thrift, v1-0001-THRIFT-895.-cpp-By-default-generate-enums-as-class-s.patch
>
>
> As of version 0.4.0 the Thrift compiler no longer allows two different enums to have a key with the same name. It seems that this change was introduced by the patch for THRIFT-544. Particularly the patch labeled: thrift-544_prevent_redefining_consts.patch.
> The problem with this patch is that it now blocks this seemingly valid definition.
> enum Foo {
> A=1,
> B=2
> }
> enum Bar {
> A=1,
> B=2
> }
> If I then run the thrift compiler as follows....
> thrift --gen java test.thrift
> It will tell me that: test.thrift:7] Enum A is already defined!
> However, this should be valid and has worked in previous versions of Thrift. I believe this patch (thrift-544_prevent_redefining_consts.patch) should be rolled back.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-895) Thrift compiler does not allow two
different enumerations to have the same key name for one of the enum values
Posted by "David Reiss (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908064#action_12908064 ]
David Reiss commented on THRIFT-895:
------------------------------------
I think Bruce explained the problem well.
However, in the C++ example, the enum types no longer have names. With the current code, a value from the Foo enum has type Foo.
> Thrift compiler does not allow two different enumerations to have the same key name for one of the enum values
> --------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-895
> URL: https://issues.apache.org/jira/browse/THRIFT-895
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (General)
> Affects Versions: 0.4
> Reporter: Tony Kinnis
> Assignee: Bryan Duxbury
> Priority: Critical
> Fix For: 0.5
>
> Attachments: test.thrift
>
>
> As of version 0.4.0 the Thrift compiler no longer allows two different enums to have a key with the same name. It seems that this change was introduced by the patch for THRIFT-544. Particularly the patch labeled: thrift-544_prevent_redefining_consts.patch.
> The problem with this patch is that it now blocks this seemingly valid definition.
> enum Foo {
> A=1,
> B=2
> }
> enum Bar {
> A=1,
> B=2
> }
> If I then run the thrift compiler as follows....
> thrift --gen java test.thrift
> It will tell me that: test.thrift:7] Enum A is already defined!
> However, this should be valid and has worked in previous versions of Thrift. I believe this patch (thrift-544_prevent_redefining_consts.patch) should be rolled back.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-895) Thrift compiler does not allow two
different enumerations to have the same key name for one of the enum values
Posted by "Tony Kinnis (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12907894#action_12907894 ]
Tony Kinnis commented on THRIFT-895:
------------------------------------
I can see from the comments in the referenced bug that this was an attempt to fix an Erlang issue. In this case I think it would have been better to change those code generators that were misbehaving rather than disabling the feature. The IDL does not specify that this is not allowed. Additionally, this was allowed in previous versions of Thrift and works without issue in other languages. I would consider this to be a fairly serious regression as it would surely break anyone who tried to upgrade to 0.4 that was making use of enumerations that had the same key names. I believe requiring an enum value to be globally unique is less than ideal and I hope others agree.
>From the looks of things it appears that Bryan is targeting this fix for 0.5. Does anyone have an estimate as to when 0.5 will ship, or could the fix be put into a patch release (0.4.x)?
> Thrift compiler does not allow two different enumerations to have the same key name for one of the enum values
> --------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-895
> URL: https://issues.apache.org/jira/browse/THRIFT-895
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (General)
> Affects Versions: 0.4
> Reporter: Tony Kinnis
> Assignee: Bryan Duxbury
> Priority: Critical
> Fix For: 0.5
>
> Attachments: test.thrift
>
>
> As of version 0.4.0 the Thrift compiler no longer allows two different enums to have a key with the same name. It seems that this change was introduced by the patch for THRIFT-544. Particularly the patch labeled: thrift-544_prevent_redefining_consts.patch.
> The problem with this patch is that it now blocks this seemingly valid definition.
> enum Foo {
> A=1,
> B=2
> }
> enum Bar {
> A=1,
> B=2
> }
> If I then run the thrift compiler as follows....
> thrift --gen java test.thrift
> It will tell me that: test.thrift:7] Enum A is already defined!
> However, this should be valid and has worked in previous versions of Thrift. I believe this patch (thrift-544_prevent_redefining_consts.patch) should be rolled back.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (THRIFT-895) Thrift compiler does not allow two
different enumerations to have the same key name for one of the enum values
Posted by "David Reiss (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-895?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
David Reiss updated THRIFT-895:
-------------------------------
Attachment: v1-0001-THRIFT-895.-cpp-By-default-generate-enums-as-class-s.patch
> Thrift compiler does not allow two different enumerations to have the same key name for one of the enum values
> --------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-895
> URL: https://issues.apache.org/jira/browse/THRIFT-895
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (General)
> Affects Versions: 0.4
> Reporter: Tony Kinnis
> Assignee: Bryan Duxbury
> Priority: Critical
> Fix For: 0.5
>
> Attachments: test.thrift, v1-0001-THRIFT-895.-cpp-By-default-generate-enums-as-class-s.patch
>
>
> As of version 0.4.0 the Thrift compiler no longer allows two different enums to have a key with the same name. It seems that this change was introduced by the patch for THRIFT-544. Particularly the patch labeled: thrift-544_prevent_redefining_consts.patch.
> The problem with this patch is that it now blocks this seemingly valid definition.
> enum Foo {
> A=1,
> B=2
> }
> enum Bar {
> A=1,
> B=2
> }
> If I then run the thrift compiler as follows....
> thrift --gen java test.thrift
> It will tell me that: test.thrift:7] Enum A is already defined!
> However, this should be valid and has worked in previous versions of Thrift. I believe this patch (thrift-544_prevent_redefining_consts.patch) should be rolled back.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (THRIFT-895) Thrift compiler does not allow two
different enumerations to have the same key name for one of the enum values
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-895?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bryan Duxbury updated THRIFT-895:
---------------------------------
Fix Version/s: 0.5
Priority: Critical (was: Major)
I'll try to have a look.
> Thrift compiler does not allow two different enumerations to have the same key name for one of the enum values
> --------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-895
> URL: https://issues.apache.org/jira/browse/THRIFT-895
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (General)
> Affects Versions: 0.4
> Reporter: Tony Kinnis
> Priority: Critical
> Fix For: 0.5
>
> Attachments: test.thrift
>
>
> As of version 0.4.0 the Thrift compiler no longer allows two different enums to have a key with the same name. It seems that this change was introduced by the patch for THRIFT-544. Particularly the patch labeled: thrift-544_prevent_redefining_consts.patch.
> The problem with this patch is that it now blocks this seemingly valid definition.
> enum Foo {
> A=1,
> B=2
> }
> enum Bar {
> A=1,
> B=2
> }
> If I then run the thrift compiler as follows....
> thrift --gen java test.thrift
> It will tell me that: test.thrift:7] Enum A is already defined!
> However, this should be valid and has worked in previous versions of Thrift. I believe this patch (thrift-544_prevent_redefining_consts.patch) should be rolled back.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-895) Thrift compiler does not allow two
different enumerations to have the same key name for one of the enum values
Posted by "Bruce Lowekamp (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908094#action_12908094 ]
Bruce Lowekamp commented on THRIFT-895:
---------------------------------------
I think that's the right way to handle that. I think making the change makes sense.
> Thrift compiler does not allow two different enumerations to have the same key name for one of the enum values
> --------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-895
> URL: https://issues.apache.org/jira/browse/THRIFT-895
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (General)
> Affects Versions: 0.4
> Reporter: Tony Kinnis
> Assignee: Bryan Duxbury
> Priority: Critical
> Fix For: 0.5
>
> Attachments: test.thrift
>
>
> As of version 0.4.0 the Thrift compiler no longer allows two different enums to have a key with the same name. It seems that this change was introduced by the patch for THRIFT-544. Particularly the patch labeled: thrift-544_prevent_redefining_consts.patch.
> The problem with this patch is that it now blocks this seemingly valid definition.
> enum Foo {
> A=1,
> B=2
> }
> enum Bar {
> A=1,
> B=2
> }
> If I then run the thrift compiler as follows....
> thrift --gen java test.thrift
> It will tell me that: test.thrift:7] Enum A is already defined!
> However, this should be valid and has worked in previous versions of Thrift. I believe this patch (thrift-544_prevent_redefining_consts.patch) should be rolled back.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-895) Thrift compiler does not allow two
different enumerations to have the same key name for one of the enum values
Posted by "David Reiss (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12907860#action_12907860 ]
David Reiss commented on THRIFT-895:
------------------------------------
This generated illegal code in both C++ and Erlang, which is why it was disabled.
> Thrift compiler does not allow two different enumerations to have the same key name for one of the enum values
> --------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-895
> URL: https://issues.apache.org/jira/browse/THRIFT-895
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (General)
> Affects Versions: 0.4
> Reporter: Tony Kinnis
> Assignee: Bryan Duxbury
> Priority: Critical
> Fix For: 0.5
>
> Attachments: test.thrift
>
>
> As of version 0.4.0 the Thrift compiler no longer allows two different enums to have a key with the same name. It seems that this change was introduced by the patch for THRIFT-544. Particularly the patch labeled: thrift-544_prevent_redefining_consts.patch.
> The problem with this patch is that it now blocks this seemingly valid definition.
> enum Foo {
> A=1,
> B=2
> }
> enum Bar {
> A=1,
> B=2
> }
> If I then run the thrift compiler as follows....
> thrift --gen java test.thrift
> It will tell me that: test.thrift:7] Enum A is already defined!
> However, this should be valid and has worked in previous versions of Thrift. I believe this patch (thrift-544_prevent_redefining_consts.patch) should be rolled back.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (THRIFT-895) Thrift compiler does not allow two
different enum's to have the same key name for one of the enum values
Posted by "Tony Kinnis (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-895?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tony Kinnis updated THRIFT-895:
-------------------------------
Attachment: test.thrift
Here is a thrift file that demonstrates the issue.
> Thrift compiler does not allow two different enum's to have the same key name for one of the enum values
> --------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-895
> URL: https://issues.apache.org/jira/browse/THRIFT-895
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (General)
> Affects Versions: 0.4
> Reporter: Tony Kinnis
> Attachments: test.thrift
>
>
> As of version 0.4.0 the Thrift compiler no longer allows two different enums to have a key with the same name. It seems that this change was introduced by the patch for THRIFT-544. Particularly the patch labeled: thrift-544_prevent_redefining_consts.patch.
> The problem with this patch is that it now blocks this seemingly valid definition.
> enum Foo {
> A=1,
> B=2
> }
> enum Bar {
> A=1,
> B=2
> }
> If I then run the thrift compiler as follows....
> thrift --gen java test.thrift
> It will tell me that: test.thrift:7] Enum A is already defined!
> However, this should be valid and has worked in previous versions of Thrift. I believe this patch (thrift-544_prevent_redefining_consts.patch) should be rolled back.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-895) Thrift compiler does not allow two
different enumerations to have the same key name for one of the enum values
Posted by "Anthony Molinaro (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908079#action_12908079 ]
Anthony Molinaro commented on THRIFT-895:
-----------------------------------------
Since 0.5 contains the big erlang refactor, people using it will have to change their code slightly anyway (at least they have to change their client code, since the way to create and manage a client changed). So changing enums at this point is probably okay. We probably just want to make sure these sorts of changes are called out in release notes for 0.5.
> Thrift compiler does not allow two different enumerations to have the same key name for one of the enum values
> --------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-895
> URL: https://issues.apache.org/jira/browse/THRIFT-895
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (General)
> Affects Versions: 0.4
> Reporter: Tony Kinnis
> Assignee: Bryan Duxbury
> Priority: Critical
> Fix For: 0.5
>
> Attachments: test.thrift
>
>
> As of version 0.4.0 the Thrift compiler no longer allows two different enums to have a key with the same name. It seems that this change was introduced by the patch for THRIFT-544. Particularly the patch labeled: thrift-544_prevent_redefining_consts.patch.
> The problem with this patch is that it now blocks this seemingly valid definition.
> enum Foo {
> A=1,
> B=2
> }
> enum Bar {
> A=1,
> B=2
> }
> If I then run the thrift compiler as follows....
> thrift --gen java test.thrift
> It will tell me that: test.thrift:7] Enum A is already defined!
> However, this should be valid and has worked in previous versions of Thrift. I believe this patch (thrift-544_prevent_redefining_consts.patch) should be rolled back.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-895) Thrift compiler does not allow two
different enumerations to have the same key name for one of the enum values
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908086#action_12908086 ]
Bryan Duxbury commented on THRIFT-895:
--------------------------------------
Spoke with David in IRC. We can make an acceptable C++ enum solution that looks like this:
{code}
class Foo {
public: enum type {A=1, B=2};
};
{code}
Then, you can reference the enum type via Foo::type and the enum values via Foo::A and Foo::B. This means the only thing that users will need to change is the reference from Foo to Foo::type.
The Erlang stuff can be fixed as was already proposed.
More generally, this means that we'll be specifying clearly that we support this kind of functionality. That is, our enums will be more Java-like than C-like.
David is going to work up a patch.
> Thrift compiler does not allow two different enumerations to have the same key name for one of the enum values
> --------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-895
> URL: https://issues.apache.org/jira/browse/THRIFT-895
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (General)
> Affects Versions: 0.4
> Reporter: Tony Kinnis
> Assignee: Bryan Duxbury
> Priority: Critical
> Fix For: 0.5
>
> Attachments: test.thrift
>
>
> As of version 0.4.0 the Thrift compiler no longer allows two different enums to have a key with the same name. It seems that this change was introduced by the patch for THRIFT-544. Particularly the patch labeled: thrift-544_prevent_redefining_consts.patch.
> The problem with this patch is that it now blocks this seemingly valid definition.
> enum Foo {
> A=1,
> B=2
> }
> enum Bar {
> A=1,
> B=2
> }
> If I then run the thrift compiler as follows....
> thrift --gen java test.thrift
> It will tell me that: test.thrift:7] Enum A is already defined!
> However, this should be valid and has worked in previous versions of Thrift. I believe this patch (thrift-544_prevent_redefining_consts.patch) should be rolled back.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-895) Thrift compiler does not allow two
different enumerations to have the same key name for one of the enum values
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908037#action_12908037 ]
Bryan Duxbury commented on THRIFT-895:
--------------------------------------
I agree that this should be legal. Is there something about Erlang and C++ that fundamentally prevents two different enums from having members with the same name?
> Thrift compiler does not allow two different enumerations to have the same key name for one of the enum values
> --------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-895
> URL: https://issues.apache.org/jira/browse/THRIFT-895
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (General)
> Affects Versions: 0.4
> Reporter: Tony Kinnis
> Assignee: Bryan Duxbury
> Priority: Critical
> Fix For: 0.5
>
> Attachments: test.thrift
>
>
> As of version 0.4.0 the Thrift compiler no longer allows two different enums to have a key with the same name. It seems that this change was introduced by the patch for THRIFT-544. Particularly the patch labeled: thrift-544_prevent_redefining_consts.patch.
> The problem with this patch is that it now blocks this seemingly valid definition.
> enum Foo {
> A=1,
> B=2
> }
> enum Bar {
> A=1,
> B=2
> }
> If I then run the thrift compiler as follows....
> thrift --gen java test.thrift
> It will tell me that: test.thrift:7] Enum A is already defined!
> However, this should be valid and has worked in previous versions of Thrift. I believe this patch (thrift-544_prevent_redefining_consts.patch) should be rolled back.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (THRIFT-895) Thrift compiler does not allow two
different enumerations to have the same key name for one of the enum values
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-895?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bryan Duxbury reassigned THRIFT-895:
------------------------------------
Assignee: Bryan Duxbury
> Thrift compiler does not allow two different enumerations to have the same key name for one of the enum values
> --------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-895
> URL: https://issues.apache.org/jira/browse/THRIFT-895
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (General)
> Affects Versions: 0.4
> Reporter: Tony Kinnis
> Assignee: Bryan Duxbury
> Priority: Critical
> Fix For: 0.5
>
> Attachments: test.thrift
>
>
> As of version 0.4.0 the Thrift compiler no longer allows two different enums to have a key with the same name. It seems that this change was introduced by the patch for THRIFT-544. Particularly the patch labeled: thrift-544_prevent_redefining_consts.patch.
> The problem with this patch is that it now blocks this seemingly valid definition.
> enum Foo {
> A=1,
> B=2
> }
> enum Bar {
> A=1,
> B=2
> }
> If I then run the thrift compiler as follows....
> thrift --gen java test.thrift
> It will tell me that: test.thrift:7] Enum A is already defined!
> However, this should be valid and has worked in previous versions of Thrift. I believe this patch (thrift-544_prevent_redefining_consts.patch) should be rolled back.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-895) Thrift compiler does not allow two
different enumerations to have the same key name for one of the enum values
Posted by "Bruce Lowekamp (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908052#action_12908052 ]
Bruce Lowekamp commented on THRIFT-895:
---------------------------------------
in C++ enum keys are scoped at the same level as the enum. so, yes
enum Foo { A=1, B=2 }
enum Bar { A=1, B=2 }
is not legal in C++.
To get something like that, you could wrap them in an enclosing class:
class Foo {
public: enum {A=1,B=2};
};
class Bar {
public: enum {A=1, B=2};
};
now you have to reference them explicitly as Foo::A and Bar::A
which would require any C++ code that used enums to be updated to refer to classnames, but I think that's the best way to support enums in the same scope having the same keys.
> Thrift compiler does not allow two different enumerations to have the same key name for one of the enum values
> --------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-895
> URL: https://issues.apache.org/jira/browse/THRIFT-895
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (General)
> Affects Versions: 0.4
> Reporter: Tony Kinnis
> Assignee: Bryan Duxbury
> Priority: Critical
> Fix For: 0.5
>
> Attachments: test.thrift
>
>
> As of version 0.4.0 the Thrift compiler no longer allows two different enums to have a key with the same name. It seems that this change was introduced by the patch for THRIFT-544. Particularly the patch labeled: thrift-544_prevent_redefining_consts.patch.
> The problem with this patch is that it now blocks this seemingly valid definition.
> enum Foo {
> A=1,
> B=2
> }
> enum Bar {
> A=1,
> B=2
> }
> If I then run the thrift compiler as follows....
> thrift --gen java test.thrift
> It will tell me that: test.thrift:7] Enum A is already defined!
> However, this should be valid and has worked in previous versions of Thrift. I believe this patch (thrift-544_prevent_redefining_consts.patch) should be rolled back.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.