Forum: JRuby jruby name lookup

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Da57cffaec80533bee0d0446b3ea6fcd?d=identicon&s=25 Michel Demazure (badal)
on 2009-04-07 12:30
I am posting this example again.
It seems to show that jruby's name lookup model is not the same as
MRI's.

module MyModule
  class MyClass
    def self.my_method
      puts "old"
    end
  end
end

include MyModule

class MyClass
  def self.my_method
    puts "new"
  end
end

MyClass.my_method
::MyModule::MyClass.my_method

MRI says :
new
new

jruby says
new
old

So, either jruby considers MyClass as a new constant (instead of looking
in the included module), or jruby's 'class' method works in its own way
(for java reasons ?).

Is the class/module hierarchy model included in the (virtual) ruby
specifications ?
This topic is locked and can not be replied to.