JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-6224

In MRI 1.9 the flag for Module#const_get also controls lookup of toplevel constants but not in JRuby

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6.5, JRuby 1.6.6, JRuby 1.7.0.pre1
    • Fix Version/s: JRuby 1.6.6
    • Component/s: Ruby 1.9.2, Ruby 1.9.3
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      In MRI 1.9 when adding the optional flag to const_get it doesn't just prevent lookup in superclasses but also at the toplevel.
      Basically Enumerable.const_get(:Array, false) raises a NameError in MRI.
      In JRuby this is not the case.

      I have created two RubySpec test cases that checks and expects the MRI behavior and therefore fails with JRuby. https://github.com/rubyspec/rubyspec/pull/86

      It is also worth mentioning that constantize in activesupport expects and builds on the MRI behavior, causing subtle problems.

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        Fixed on master@404c280 and jruby-1_6@c9c292b.

        Show
        Charles Oliver Nutter added a comment - Fixed on master@404c280 and jruby-1_6@c9c292b.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Brian Olsen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: