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

Divergent behavior in MRI vs JRuby wrt Class::undef #2131

cheald opened this Issue Nov 6, 2014 · 1 comment


None yet
3 participants
Copy link

cheald commented Nov 6, 2014

Under MRI - tested 1.9.3, 2.0.0, 2.1.0, and 2.2.0-preview:

c1 = {private; def foo; end}
c2 = {public; :foo}
c1.class_eval {undef foo} => NoMethodError

Under JRuby:

c1 = {private def foo; end}
c2 = {public :foo}
c1.class_eval {undef foo} => nil

This notably breaks a test in the new stdlib, to the effect of

c1 = {private def foo; end}
c2 = {public :foo}
c3 = {def foo; end}
c1.class_eval {undef foo}
m = c3.instance_method(:foo).super_method # Expects nil, gets c2's copy of #foo.

This comment has been minimized.

Copy link

rtyler commented Aug 7, 2015

This is fixed in JRuby 9k at least

[27] pry(main)> c1 = {private def foo; end}
=> #<Class:0x70f59913>
[28] pry(main)> c2 = {public :foo}
=> #<Class:0x77258e59>
[29] pry(main)> c1.class_eval {undef foo}
=> nil
[30] pry(main)> 
NoMethodError: undefined method `foo' for #<Class:0x77258e59>
from org/jruby/ `method_missing'
[31] pry(main)> JRUBY_VERSION
=> ""
[32] pry(main)> 

@rtyler rtyler closed this Aug 7, 2015

@enebo enebo added this to the JRuby milestone Aug 20, 2015

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.