[
https://issues.apache.org/jira/browse/THRIFT-556?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13204245#comment-13204245
]
Ben Kelly commented on THRIFT-556:
----------------------------------
I can confirm this is still a problem in thrift 0.8.0. See:
https://github.com/nearinfinity/blur/issues/167
The following patch against the thrift 0.8.x branch fixes the issue for me:
{code}
--- t_rb_generator.cc.orig 2012-02-08 23:20:54.000000000 -0500
+++ t_rb_generator.cc 2012-02-08 23:21:02.000000000 -0500
@@ -1070,7 +1070,7 @@
}
string t_rb_generator::full_type_name(t_type* ttype) {
- string prefix = "";
+ string prefix = "::";
vector<std::string> modules = ruby_modules(ttype->get_program());
for (vector<std::string>::iterator m_iter = modules.begin();
m_iter != modules.end(); ++m_iter) {
{code}
> Ruby compiler does not correctly referred to top-level modules when a
> submodule masks the top-level name
> --------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-556
> URL: https://issues.apache.org/jira/browse/THRIFT-556
> Project: Thrift
> Issue Type: Bug
> Components: Ruby - Compiler
> Reporter: Evan Weaver
>
> Currently, if you set a top-level module for thrift/ruby that's the same name
> as an inner class, thrift does not reference the top level appropriately.
> Example bad code:
> .thrift:
> namespace rb Cassandra
> .rb:
> module Cassandra
> module Cassandra
> class Client
> ...
> COLUMN_PARENT => {:type => ::Thrift::Types::STRUCT, :name =>
> 'column_parent', :class => Cassandra::ColumnParent},
> Ruby checks the inner module first, and does not find the class, raising an
> error.
> The fix is to have every place that references the top-level module prepend
> it with '::':
> COLUMN_PARENT => {:type => ::Thrift::Types::STRUCT, :name =>
> 'column_parent', :class => ::Cassandra::ColumnParent},
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira