Skip to content
This repository

When call Kernel#singleton_class. And instance variables disappeared from Kernel#inspect. #266

Closed
kachick opened this Issue August 21, 2012 · 2 comments

2 participants

Kenichi Kamiya Charles Oliver Nutter
Kenichi Kamiya

Are below behaviors expected in JRuby?

$VERBOSE = true

class Foo

  def initialize(bool)
    @pre = 1

    if bool
      singleton_class
    end

    @post = 2
  end

end

p Foo.new(true)
p Foo.new(false)

CRuby

ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]

#<Foo:0x858b8b4 @pre=1, @post=2>
#<Foo:0x858b814 @pre=1, @post=2>

JRuby

jruby 1.7.0.preview2 (1.9.3p203) 2012-08-21 82eb396 on OpenJDK Server VM 1.6.0_24-b24 [linux-i386]

#<Foo:0xb655a>
#<Foo:0x2b1682 @pre=1, @post=2>
Charles Oliver Nutter
Owner

Definitely a bug, but it seems to only affect inspect...the variables are still there.

Charles Oliver Nutter headius closed this issue from a commit August 21, 2012
Charles Oliver Nutter Fix #266.
We weren't using the "real class", which has the ivar list.
9dc5553
Charles Oliver Nutter headius closed this in 9dc5553 August 21, 2012
Kenichi Kamiya

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.