[ 
https://issues.apache.org/jira/browse/THRIFT-857?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12900354#action_12900354
 ] 

Bruce Lowekamp commented on THRIFT-857:
---------------------------------------

I submitted a THRIFT-859 (with patch) that proposes reverting the check that 
caused this problem in the first place.

t_program.h was revised to include (everything but the last 
namespace[language]=namespace assignment:


  void set_namespace(std::string language, std::string name_space) {
    t_generator_registry::gen_map_t my_copy = 
t_generator_registry::get_generator_map();

    t_generator_registry::gen_map_t::iterator it;
    it=my_copy.find(language);

    if (it == my_copy.end()) {
      if (language != "smalltalk.prefix" && language != "smalltalk.package" && 
language != "py.twisted") {
        throw "No generator named '" + language + "' could be found!";
      }
    }
    namespaces_[language] = name_space;
  }



Not only does this blow up when a generator is disabled, but it also
- prevents anyone from adding a new sub-namespace without modifying this code, 
as with smalltalk.prefix and smalltalk.package
- actually skips the check it's intended to do in the smalltalk case, i.e. you 
can declare a smalltalk.prefix namespace without having the smalltalk generator 
enabled

We ran into this because we had a mod to declare a separate namespace for 
py.twisted, which is what I'm about to put an issue in for.

Now, if it's really important to check that the generator is there for a 
namespace declaration, then the *right* way to do this is to take the base 
language name, check that there's a generator for it, then if there's a 
sub-language (smalltalk.package or py.twisted) call into the generator to see 
if it recognizes the declaration.

That seems like a lot of effort to put the support into every generator for 
relatively little benefit.  I care a lot more about whether there's a missing 
namespace declaration for a language I'm trying to generate than if there's a 
namespace declaration for a language I'm not trying to generate.

So as part of THRIFT-859, I think we should just revert the change to 
t_program.h, allow any namespace declaration to be made, and let the generator 
report an error if it's unhappy with there not being a namespace, etc.



> tests run by "make install" fail if generators are disabled
> -----------------------------------------------------------
>
>                 Key: THRIFT-857
>                 URL: https://issues.apache.org/jira/browse/THRIFT-857
>             Project: Thrift
>          Issue Type: Bug
>          Components: Test Suite
>    Affects Versions: 0.4
>         Environment: mac os
>            Reporter: Bruce Lowekamp
>            Priority: Minor
>
> configuring with generators disabled (configure --disable-gen-java, for 
> example) produces a failed build because the tests run by "make install" 
> require the java, cpp, rb, perl, csharp, and js generators.  
> I would personally favor either removing those --disble-gen options 
> altogether, or adding a warning message in the configure --help output that 
> disabling those generators is not recommended/will cause test failure.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to