Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.1.6, JRuby 1.2
-
Fix Version/s: JRuby 1.7.0.pre1
-
Component/s: Core Classes/Modules
-
Labels:None
-
Number of attachments :
Description
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.
Wow just when you think you have seen them all. This is not a regression, but just another whacky constant resolution bug. Toplevel::Foo should resolve to Mod::Foo since Mod has been included into the TopLevel. Something in our Colon2 logic is wrong. Certainly since this is Object and we have 'special' logic for Object.