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

Unable to hide a singleton method created by an extend #2393

Closed
rjnienaber opened this issue Dec 30, 2014 · 4 comments
Closed

Unable to hide a singleton method created by an extend #2393

rjnienaber opened this issue Dec 30, 2014 · 4 comments

Comments

@rjnienaber
Copy link

@rjnienaber rjnienaber commented Dec 30, 2014

From: http://jira.codehaus.org/browse/JRUBY-5439. Not working on JRuby 1.7.18 and JRuby 9000.

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).

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.

@headius
Copy link
Member

@headius headius commented Dec 2, 2020

@rjnienaber This appears to still be an issue on JRuby master. Why did you close the issue?

@rjnienaber
Copy link
Author

@rjnienaber rjnienaber commented Dec 2, 2020

@headius I was doing some spring cleaning of my GitHub issues that were > 1y old across a number of projects and this was one of them.

@headius
Copy link
Member

@headius headius commented Dec 2, 2020

If it is ok with you I would prefer to keep this open, since it documents an unfixed issue.

Perhaps you can remember whether this affect application code? Like, did it break something you needed, or did you just happen to notice the behavior was incorrect?

@headius headius reopened this Dec 2, 2020
@rjnienaber
Copy link
Author

@rjnienaber rjnienaber commented Dec 2, 2020

IIRC, I raised this issue during the migration from codehaus to github. At the time I was trying to contribute to the project and in my case, it was testing old issues to see if they had already been fixed. I didn't personally experience this issue.

My problem with keeping this issue open is that it shows up in my personal list of issues as a TODO for me. I haven't used JRuby since 2016 and since this hasn't been fixed in 6 years, it doesn't seem like a priority.

Would it be possible to create a new issue under your name and reference this one?

@rjnienaber rjnienaber closed this Dec 10, 2020
@enebo enebo added this to the Invalid or Duplicate milestone Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants