Cannot reopen a class from an included module
---------------------------------------------

                 Key: JRUBY-3293
                 URL: http://jira.codehaus.org/browse/JRUBY-3293
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1.6, JRuby 1.1.7
            Reporter: Ryan Phelps


module Mod
  class Foo
    def foo
      puts "foo"
    end
  end
end

include Mod

class Foo
  def bar
    puts "bar"
  end
end

f = Foo.new
f.bar
f.foo


Results from running the above script with Ruby and JRuby:

$ ruby -v
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
$ jruby -v
jruby 1.1.7 (ruby 1.8.6 patchlevel 114) (2009-01-07 rev 6586) [i386-java]
$ ruby test.rb 
bar
foo
$ jruby test.rb 
bar
test.rb:19: undefined method `foo' for #<Foo:0xbd9256> (NoMethodError)


Reopening the Foo class as Mod::Foo works. From what I've seen, 
RubyModule.getConstantAt can't locate the included class (called from 
defineOrGetClassUnder) whereas RubyModule.getConstantNoConstMissing can.

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


Reply via email to