Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-556

Ruby compiler does not correctly referred to top-level modules when a submodule masks the top-level name

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.9
    • Component/s: Ruby - Compiler
    • Labels:
      None

      Description

      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},

        Attachments

          Activity

            People

            • Assignee:
              wanderview Ben Kelly
              Reporter:
              eweaver Evan Weaver
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: