We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It looks like JRuby doesn't correctly keep track of method visibility for those defined in eval.
MRI:
$ ruby -v ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux $ ruby -e "cls = Class.new; cls.module_eval { eval('def x; :x; end') }; p cls.new.x" :x $ ruby -e "cls = Class.new; cls.module_eval { eval('private; def x; :x; end') }; p cls.new.x" -e:1:in `<main>': private method `x' called for #<#<Class:0x007f9bac9dc818>:0x007f9bac9dc408> (NoMethodError) $ ruby -e "cls = Class.new; cls.module_eval { eval('private def x; :x; end') }; p cls.new.x" -e:1:in `<main>': private method `x' called for #<#<Class:0x007f1c997a4920>:0x007f1c997a4538> (NoMethodError)
JRuby:
$ bin/jruby -v jruby 9.0.0.0-SNAPSHOT (2.2.0p0) 2014-12-29 cce55de Java HotSpot(TM) 64-Bit Server VM 24.72-b04 on 1.7.0_72-b14 +jit [linux-amd64] $ bin/jruby -e "cls = Class.new; cls.module_eval { eval('def x; :x; end') }; p cls.new.x" :x $ bin/jruby -e "cls = Class.new; cls.module_eval { eval('private; def x; :x; end') }; p cls.new.x" :x $ bin/jruby -e "cls = Class.new; cls.module_eval { eval('private def x; :x; end') }; p cls.new.x" :x
The text was updated successfully, but these errors were encountered:
I don't know if I'm just dreaming or what but I think there are no private methods at all on master.
Just a couple of examples:
$ bin/jruby -e "class Klass; def x; :x; end; private :x; end; p Klass.new.x" :x $ bin/jruby -e "String.fail 'Oh no'" RuntimeError: Oh no bin/jruby -e "String.remove_method :to_s"
Sorry, something went wrong.
I suspect this is a simple problem of the JIT not enforcing visibiity:
~/projects/jruby $ jruby -e "String.remove_method :to_s" ~/projects/jruby $ jruby -X-C -e "String.remove_method :to_s" NoMethodError: undefined method `remove_method' for String:Class method_missing at org/jruby/RubyBasicObject.java:1600 (root) at -e:1
131970a
No branches or pull requests
It looks like JRuby doesn't correctly keep track of method visibility for those defined in eval.
MRI:
JRuby:
The text was updated successfully, but these errors were encountered: