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

When child class delegates to_s to parent, JRuby outputs child object attributes #1226

Closed
philipmw opened this issue Nov 14, 2013 · 3 comments

Comments

@philipmw
Copy link

Evaluate this:

class BaseBlah; end
class Blah < BaseBlah
  def initialize
    @my_attr = {secret: 'sec'}
  end
  def to_s
    super.to_s
  end
end
puts "#{[Blah.new].to_s}"

In Ruby MRI, output:

[#<Blah:0x002b25ba7e2588>]

In JRuby 1.7.7, output:

[#<Blah:0x6c5739ec @my_attr={:secret=>"sec"}>]
@tduehr
Copy link
Contributor

tduehr commented Jul 9, 2014

The JRuby output here matches the output of MRI 2.0.0+

The MRI output from @philipmw is from 1.9.3

@enebo
Copy link
Member

enebo commented May 11, 2016

JRuby 9.x is correct and JRuby 1.7.x is wrong in 1.9 mode.

@enebo enebo added this to the Won't Fix milestone Feb 17, 2017
@enebo
Copy link
Member

enebo commented Feb 17, 2017

This works in 9k and we will never fix this in 1.7.x as it is winding down....resolving.

@enebo enebo closed this as completed Feb 17, 2017
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

3 participants