Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JRuby 9.0.0.0.pre2 raises "NameError: uninitialized class variable @@PREFIX_MAP in Object", doesn't occur in Ruby 2.2.x #3042

Closed
garysweaver opened this Issue Jun 12, 2015 · 2 comments

Comments

Projects
None yet
3 participants
@garysweaver
Copy link

commented Jun 12, 2015

Have a project with the following in the Gemfile:

gem 'rails-units', '~> 1.6.0', github: 'garysweaver/rails-units'

In Rails, when it hits Bundler.require(:default, Rails.env) in application.rb, it spews:

$ rake test
rake aborted!
NameError: uninitialized class variable @@PREFIX_MAP in Object
.../.rvm/gems/jruby-9.0.0.0.pre2@.../bundler/gems/rails-units-20913bc1b887/lib/rails_units/unit.rb:123:in `block in setup'
.../.rvm/gems/jruby-9.0.0.0.pre2@.../bundler/gems/rails-units-20913bc1b887/lib/rails_units/unit.rb:122:in `block in setup'
.../.rvm/gems/jruby-9.0.0.0.pre2@.../bundler/gems/rails-units-20913bc1b887/lib/rails_units/unit.rb:118:in `setup'
.../.rvm/gems/jruby-9.0.0.0.pre2@.../bundler/gems/rails-units-20913bc1b887/lib/rails_units/unit.rb:1272:in `<top>'
.../.rvm/gems/jruby-9.0.0.0.pre2@.../gems/activesupport-4.../lib/active_support/dependencies.rb:1:in `block in (root)'
.../.rvm/gems/jruby-9.0.0.0.pre2@.../gems/activesupport-4.../lib/active_support/dependencies.rb:229:in `require'
.../.rvm/gems/jruby-9.0.0.0.pre2@.../gems/activesupport-4.../lib/active_support/dependencies.rb:214:in `load_dependency'
.../.rvm/gems/jruby-9.0.0.0.pre2@.../gems/activesupport-4.../lib/active_support/dependencies.rb:229:in `<top>'
.../.rvm/gems/jruby-9.0.0.0.pre2@.../bundler/gems/rails-units-20913bc1b887/lib/rails-units.rb:12:in `block in (root)'
.../.rvm/gems/jruby-9.0.0.0.pre2@.../gems/bundler-1.10.3/lib/bundler/runtime.rb:1:in `block in (root)'
.../.rvm/gems/jruby-9.0.0.0.pre2@.../gems/bundler-1.10.3/lib/bundler/runtime.rb:76:in `require'
.../.rvm/gems/jruby-9.0.0.0.pre2@.../gems/bundler-1.10.3/lib/bundler/runtime.rb:72:in `require'
.../.rvm/gems/jruby-9.0.0.0.pre2@.../gems/bundler-1.10.3/lib/bundler/runtime.rb:61:in `<top>'
.../.rvm/gems/jruby-9.0.0.0.pre2@.../gems/bundler-1.10.3/lib/bundler.rb:134:in `<top>'
.../config/application.rb:10:in `(root)'
.../Rakefile:1:in `(root)'
.../Rakefile:5:in `block in (root)'

It doesn't raise this in Ruby 2.2.x or JRuby 1.7.20, so it's a bit odd.

@garysweaver garysweaver changed the title JRuby 9.0.0.0.pre2 raises "NameError: uninitialized class variable @@PREFIX_MAP in Object" and doesn't occur in MRI 2.2.x JRuby 9.0.0.0.pre2 raises "NameError: uninitialized class variable @@PREFIX_MAP in Object" and doesn't occur in Ruby 2.2.x Jun 12, 2015

@garysweaver garysweaver changed the title JRuby 9.0.0.0.pre2 raises "NameError: uninitialized class variable @@PREFIX_MAP in Object" and doesn't occur in Ruby 2.2.x JRuby 9.0.0.0.pre2 raises "NameError: uninitialized class variable @@PREFIX_MAP in Object", doesn't occur in Ruby 2.2.x Jun 12, 2015

@enebo enebo added this to the JRuby 9.0.0.0.rc2 milestone Jun 14, 2015

@enebo

This comment has been minimized.

Copy link
Member

commented Jun 14, 2015

Reduced test case:

class Foo
  @@A = {}

  def self.setup
    for name in [1] do
      for value in [1] do
        p @@A
      end
    end
  end
end

Foo.setup

Looks like we are counting for scopes in our calculation for cvars? Only one for loop is fine. for in Ruby is over time becoming increasingly esoteric so I suspect we lack some coverage here...

@subbuss subbuss closed this in d2979e3 Jun 14, 2015

@subbuss

This comment has been minimized.

Copy link
Contributor

commented Jun 14, 2015

@garysweaver please verify fix. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.