Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major 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 :
      0

      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.

        Activity

        Hide
        Thomas E Enebo added a comment -

        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.

        Show
        Thomas E Enebo added a comment - 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.
        Hide
        Diego Plentz added a comment -

        Working here in jruby 1.6.7 in both 1.8 and 1.9 modes. Can be closed.

        Show
        Diego Plentz added a comment - Working here in jruby 1.6.7 in both 1.8 and 1.9 modes. Can be closed.
        Hide
        Thomas E Enebo added a comment -

        Resolving since this must have been fixed months ago now.

        Show
        Thomas E Enebo added a comment - Resolving since this must have been fixed months ago now.

          People

          • Assignee:
            Thomas E Enebo
            Reporter:
            Ryan Phelps
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: