Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.7.0.pre1
    • Fix Version/s: JRuby 1.7.0.pre1
    • Component/s: Compiler
    • Labels:
      None
    • Environment:
      Java 7
    • Number of attachments :
      0

      Description

      Again this testcase seems to be part of the one that is shipped with ruby 1.7.0 source .

      require 'test/unit'
      
      class TestLoop19 < Test::Unit::TestCase
        def test_loop_catches_rescues_iteration_and_does_not_export_scope
          loop do
            n = 1
            raise StopIteration
          end
          assert_raises NameError do n end  <--------------------------------
        end
      end
      

      While running this against Java 7 SR1 , I get the following error

      test_loop_catches_rescues_iteration_and_does_not_export_scope(TestLoop19):
      NoMethodError: undefined method `foo' for #<TestLoop19:0xcf5a8ceb> <--------------------------------------------------
          /home/vinunaya/ruby/test/test_loop_1_9.rb:6:in `test_loop_catches_rescues_iteration_and_does_not_export_scope'
          org/jruby/RubyKernel.java:1342:in `loop'
          /home/vinunaya/ruby/test/test_loop_1_9.rb:5:in `test_loop_catches_rescues_iteration_and_does_not_export_scope'
          org/jruby/RubyKernel.java:1944:in `send'
          org/jruby/RubyArray.java:1603:in `each'
          org/jruby/RubyArray.java:1603:in `each'
      

      So if we observed the lines pointed out in the above failure message , it is basically getting a "NoMethodError" from the "do...end" block rather than the "NameError" expected.

      So further looking into the issue , the above can be recreated even with a simple change to testcase .

      class TestLoop19 < Test::Unit::TestCase
        def test_loop_catches_rescues_iteration_and_does_not_export_scope
           loop do
            puts foo   <--------------------------
            raise StopIteration
          end
        end
      

      So here I have removed the assertion and added a "puts " statement instead. If I run this with Java 7 SR1 , I get the error as mentioned above where as with Java 6 I get "NameError" as expected .

      As per http://www.ruby-doc.org/core-1.9.3/NameError.html documentation we should be getting the "NameError" error itself .

      Again here also ,when I tried running jruby with "--debug" option ( on Java7 SR1 line) I see the testcase passes .

      I have raised JRUBY-6300 which was for slightly different issue but there too with "--debug" option it was passing . So I am not sure if these are related . If yes can you please let me know the build number where this is fixed . If not , can you please help with this issue . ?

        Activity

        Hide
        Hiro Asari added a comment -

        Note that the test script works fine in the interpreted mode. I am assigning this to Charlie, since this is most likely a compiler issue.

        $ jruby -v -X-C --1.9 jruby-6301.rb 
        jruby 1.7.0.dev (ruby-1.9.3-p0) (2011-12-26 8eec92d) (OpenJDK 64-Bit Server VM 1.7.0-u2-b21) [darwin-amd64-java]
        Run options: 
        
        # Running tests:
        
        .
        
        Finished tests in 0.048000s, 20.8333 tests/s, 20.8333 assertions/s.
        
        1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
        
        Show
        Hiro Asari added a comment - Note that the test script works fine in the interpreted mode. I am assigning this to Charlie, since this is most likely a compiler issue. $ jruby -v -X-C --1.9 jruby-6301.rb jruby 1.7.0.dev (ruby-1.9.3-p0) (2011-12-26 8eec92d) (OpenJDK 64-Bit Server VM 1.7.0-u2-b21) [darwin-amd64-java] Run options: # Running tests: . Finished tests in 0.048000s, 20.8333 tests/s, 20.8333 assertions/s. 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
        Hide
        Charles Oliver Nutter added a comment -

        commit 2eb32936b3352b88803f9900c68f018bf2a75cc6
        Author: Charles Oliver Nutter <headius@headius.com>
        Date: Sat Dec 31 13:35:45 2011 -0600

        Fix JRUBY-6301: scripting_lang.jruby:undefined method in test_loop_1_9.rb

        Invokedynamic-based dispatch was not handling the "vcall" case, and
        as a result it only ever raised NoMethodError for method_missing.

        Show
        Charles Oliver Nutter added a comment - commit 2eb32936b3352b88803f9900c68f018bf2a75cc6 Author: Charles Oliver Nutter <headius@headius.com> Date: Sat Dec 31 13:35:45 2011 -0600 Fix JRUBY-6301 : scripting_lang.jruby:undefined method in test_loop_1_9.rb Invokedynamic-based dispatch was not handling the "vcall" case, and as a result it only ever raised NoMethodError for method_missing.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Vinutha Nayak
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: