Unable to hide a singleton method created by an extend ------------------------------------------------------
Key: JRUBY-5439 URL: http://jira.codehaus.org/browse/JRUBY-5439 Project: JRuby Issue Type: Bug Components: Interpreter Affects Versions: JRuby 1.5.6 Environment: Mac OSX 10.6.5 Reporter: Stephen Morss Priority: Minor If I create a module and extend it in an object, creating singleton_methods, I should be able to hide one of the object's singleton methods by making it private. This works in MRI Ruby 1.8.7, Ruby 1.9.1, and many of the derivatives (I've also tried it in MacRuby 0.8, and REE 1.8.7). The following code behaves differently in MRI and JRuby 1.5.6 # simple module module Xmod def amethod end end # create an object with singleton methods by extending Xmod x = Object.new x.extend Xmod p x.singleton_methods # ["amethod"] # we're all good here # change the singleton method to private class << x private :amethod end # shouldn't see private method any more, but JRuby still shows it p x.singleton_methods # MRI => [], JRuby 1.5.6 => ["amethod"] Note, I tried to simplify the test by just trying: y = Object.new class << y def another_method end private :another_method end p y.singleton_methods But this test case works. The bug only shows up with a singleton method created by an extend. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email