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

Wierd failure when using with jruby #36

Closed
iwakura opened this issue Apr 15, 2014 · 6 comments
Closed

Wierd failure when using with jruby #36

iwakura opened this issue Apr 15, 2014 · 6 comments
Milestone

Comments

@iwakura
Copy link

iwakura commented Apr 15, 2014

Hello,

I'm using gem version 3.4.0 and on ruby 2.0 it works well, but with jruby 1.7.11 fails.

Here is my app/enums/status.rb:

class Status < ClassyEnum::Base
end

class Status::Started < Status
end

class Status::Running < Status
end

class Status::Failed < Status
end

class Status::Complete < Status
end

Here is a stack trace.

NoMethodError: super: no superclass method `visit_Status_Started'
              inherited at /home/craw/.rvm/gems/jruby-1.7.11/gems/classy_enum-3.4.0/lib/classy_enum/base.rb:72
                 (root) at /home/craw/app/app/enums/status.rb:4
                require at org/jruby/RubyKernel.java:1085
                require at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251
        load_dependency at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:236
                require at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251
                 (root) at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:1
        require_or_load at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:359
  load_missing_constant at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:502
                   each at org/jruby/RubyArray.java:1613
          const_missing at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:192
          const_missing at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:190
                   each at org/jruby/RubyArray.java:1613
            constantize at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/inflector/methods.rb:230
            constantize at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/inflector/methods.rb:229
            constantize at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/core_ext/string/inflections.rb:54
       classy_enum_attr at /home/craw/.rvm/gems/jruby-1.7.11/gems/classy_enum-3.4.0/lib/classy_enum/active_record.rb:56
                  Batch at /home/craw/app/app/models/batch.rb:3
                require at org/jruby/RubyKernel.java:1085
                require at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251
        load_dependency at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:236
                require at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251
                 (root) at /home/craw/app/app/models/batch.rb:1
                 (root) at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:1
        require_or_load at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:359
                   each at org/jruby/RubyArray.java:1613
  load_missing_constant at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:502
          const_missing at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:192
                   each at org/jruby/RubyArray.java:1613
          const_missing at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:190
            constantize at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/inflector/methods.rb:230
            constantize at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/inflector/methods.rb:229
       safe_constantize at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/inflector/methods.rb:260
       safe_constantize at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/core_ext/string/inflections.rb:66
    _default_wrap_model at /home/craw/.rvm/gems/jruby-1.7.11/gems/actionpack-3.2.16/lib/action_controller/metal/params_wrapper.rb:152
  _set_wrapper_defaults at /home/craw/.rvm/gems/jruby-1.7.11/gems/actionpack-3.2.16/lib/action_controller/metal/params_wrapper.rb:169
              inherited at /home/craw/.rvm/gems/jruby-1.7.11/gems/actionpack-3.2.16/lib/action_controller/metal/params_wrapper.rb:133
              inherited at /home/craw/.rvm/gems/jruby-1.7.11/gems/actionpack-3.2.16/lib/abstract_controller/railties/routes_helpers.rb:7
                require at org/jruby/RubyKernel.java:1085
                require at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251
        load_dependency at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:236
                require at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251
              inherited at /home/craw/.rvm/gems/jruby-1.7.11/gems/actionpack-3.2.16/lib/action_controller/railties/paths.rb:7
                 (root) at /home/craw/app/app/controllers/batch_controller.rb:1
                 (root) at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:1
        require_or_load at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:359
                   each at org/jruby/RubyArray.java:1613
              depend_on at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:313
                   each at org/jruby/RubyArray.java:1613
     require_dependency at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:225
            eager_load! at /home/craw/.rvm/gems/jruby-1.7.11/gems/railties-3.2.16/lib/rails/engine.rb:444
          instance_exec at org/jruby/RubyBasicObject.java:1565
                    run at /home/craw/.rvm/gems/jruby-1.7.11/gems/railties-3.2.16/lib/rails/initializable.rb:30
            eager_load! at /home/craw/.rvm/gems/jruby-1.7.11/gems/railties-3.2.16/lib/rails/engine.rb:443
                   each at org/jruby/RubyArray.java:1613
            eager_load! at /home/craw/.rvm/gems/jruby-1.7.11/gems/railties-3.2.16/lib/rails/engine.rb:441
               Finisher at /home/craw/.rvm/gems/jruby-1.7.11/gems/railties-3.2.16/lib/rails/application/finisher.rb:53
       run_initializers at /home/craw/.rvm/gems/jruby-1.7.11/gems/railties-3.2.16/lib/rails/initializable.rb:55
       run_initializers at /home/craw/.rvm/gems/jruby-1.7.11/gems/railties-3.2.16/lib/rails/initializable.rb:54
                require at org/jruby/RubyKernel.java:1085
                require at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251
        load_dependency at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:236
                require at /home/craw/.rvm/gems/jruby-1.7.11/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251
            initialize! at /home/craw/.rvm/gems/jruby-1.7.11/gems/railties-3.2.16/lib/rails/application.rb:136
         method_missing at /home/craw/.rvm/gems/jruby-1.7.11/gems/railties-3.2.16/lib/rails/railtie/configurable.rb:30
                require at org/jruby/RubyKernel.java:1085
                 (root) at script/rails:6

I see you're supporting only CRuby, but probably can help.

@beerlington
Copy link
Owner

Thanks for reporting! This seems like an incompatibility between the C Ruby API and JRuby. Unfortunately the piece of code that is raising the exception is just a hack to get around some issues with ActiveRecord and Arel. I'd love to get rid of that code, but it would break backwards compatibility with older versions of the gem and I'm not sure I want to do that just yet.

FWIW the offending line is here and super should only be calling inherited at that point, but it looks like it's calling one of the dynamically defined methods from above. No clue why that's happening, but I'm thinking it's probably not expected.

I'm going to open an issue in the JRuby project and leave this open for a bit, but I wouldn't count on it being fixed any time soon seeing as there are close to 400 open issues. :/

@nicbor
Copy link

nicbor commented Jun 3, 2014

+1 on this.

@beerlington
Copy link
Owner

@nicbor I spent a bunch of time tracking down the issue and it's out of my control. Feel free to nudge the folks on the JRuby project, but good luck since it seems like things are pretty stagnant over there these days.

@nicbor
Copy link

nicbor commented Jun 3, 2014

What a shame. Thanks. Love classy_enum by the way.

@beerlington
Copy link
Owner

For the time being, you could always fork the repo and remove these lines if this is a roadblocker. In the future I would like to eliminate that hack, but haven't been able to find a solution that works with all versions of Rails that this project supports.

theangryangel added a commit to theangryangel/classy_enum-jruby-fix that referenced this issue Jun 30, 2014
Removes lines 42 -> 62 to resolve an issue with jruby until beerlington#36
 is resolved.
@beerlington beerlington added this to the Release 4.0 milestone Sep 27, 2014
@beerlington
Copy link
Owner

Closed in 963ac91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants