Skip to content

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

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

2 participants

@kachick
kachick commented Aug 21, 2012

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>
@headius
JRuby Team member
headius commented Aug 21, 2012

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

@headius headius added a commit that closed this issue Aug 21, 2012
@headius headius Fix #266.
We weren't using the "real class", which has the ivar list.
9dc5553
@headius headius closed this in 9dc5553 Aug 21, 2012
@kachick
kachick commented Aug 22, 2012

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.