Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6.1, JRuby 1.7.0.pre1
    • Fix Version/s: JRuby 1.7.0.pre1
    • Labels:
      None
    • Environment:
      Arch Linux, x86_64, 2.6.38
    • Number of attachments :
      0

      Description

      The below snippet explains everything.

      [gabor@gabor-desktop-arch ~]$ rvm use jruby
      Using /home/gabor/.rvm/gems/jruby-1.6.1
      [gabor@gabor-desktop-arch ~]$ rvm --version
      
      rvm 1.6.13 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]
      
      [gabor@gabor-desktop-arch ~]$ jruby -v
      jruby 1.6.1 (ruby-1.9.2-p136) (2011-04-12 85838f6) (OpenJDK 64-Bit Server VM 1.6.0_22) [linux-amd64-java]
      [gabor@gabor-desktop-arch ~]$ ruby
      /(?<a>.+)/ =~ ""
      RuntimeHelpers.java:2241:in `updateScopeWithCaptures': java.lang.ClassCastException: org.jruby.RubyNil cannot be cast to org.jruby.RubyMatchData
      	from RuntimeHelpers.java:2228:in `match2AndUpdateScope'
      	from -:1:in `__file__'
      	from -:-1:in `load'
      	from Ruby.java:671:in `runScript'
      	from Ruby.java:575:in `runNormally'
      	from Ruby.java:424:in `runFromMain'
      	from Main.java:278:in `doRunFromMain'
      	from Main.java:198:in `internalRun'
      	from Main.java:164:in `run'
      	from Main.java:148:in `run'
      	from Main.java:128:in `main'
      [gabor@gabor-desktop-arch ~]$ irb
      jruby-1.6.1 :001 > /(?<a>.+)/ =~ ""
       => nil 
      jruby-1.6.1 :002 > exit
      

        Activity

        Hide
        Hiro Asari added a comment -

        I assume that you have JRUBY_OPTS='--1.9'; if you have non-default options set, please indicate it. Thank you.

        Show
        Hiro Asari added a comment - I assume that you have JRUBY_OPTS='--1.9' ; if you have non-default options set, please indicate it. Thank you.
        Hide
        Gabor Szarka added a comment -

        Yes, you're right, sorry. I have JRUBY_OPTS='--1.9', but that's all.

        Show
        Gabor Szarka added a comment - Yes, you're right, sorry. I have JRUBY_OPTS='--1.9', but that's all.
        Hide
        Charles Oliver Nutter added a comment -

        Appears to have been fixed on jruby-1_6 branch, and presumably on master as well.

        ~/projects/jruby ” jruby --1.9 -S jirb
        >> JRUBY_VERSION
        => "1.6.3.dev"
        >> RUBY_VERSION
        => "1.9.2"
        >> /(?<a>.+)/ =~ ""
        => nil
        >> quit
        
        Show
        Charles Oliver Nutter added a comment - Appears to have been fixed on jruby-1_6 branch, and presumably on master as well. ~/projects/jruby ” jruby --1.9 -S jirb >> JRUBY_VERSION => "1.6.3.dev" >> RUBY_VERSION => "1.9.2" >> /(?<a>.+)/ =~ "" => nil >> quit
        Hide
        Syver Enstad added a comment - - edited

        I am using jruby 1.6.7 and the issue seems to be still present

        > jruby

        puts JRUBY_VERSION
        puts RUBY_VERSION
        /(?<a>.+)/ =~ ""
        

        == Output ===
        1.6.7
        1.9.2
        RuntimeHelpers.java:2453:in `updateScopeWithCaptures': java.lang.ClassCastException: org.jruby.RubyNil cannot be cast to org.jruby.RubyMatchData
        from RuntimeHelpers.java:2440:in `match2AndUpdateScope19'
        from -:3:in `_file_'
        from -:-1:in `load'
        from Ruby.java:697:in `runScript'
        from Ruby.java:690:in `runScript'
        from Ruby.java:597:in `runNormally'
        from Ruby.java:446:in `runFromMain'
        from Main.java:369:in `doRunFromMain'
        from Main.java:258:in `internalRun'
        from Main.java:224:in `run'
        from Main.java:208:in `run'
        from Main.java:188:in `main'

        Show
        Syver Enstad added a comment - - edited I am using jruby 1.6.7 and the issue seems to be still present > jruby puts JRUBY_VERSION puts RUBY_VERSION /(?<a>.+)/ =~ "" == Output === 1.6.7 1.9.2 RuntimeHelpers.java:2453:in `updateScopeWithCaptures': java.lang.ClassCastException: org.jruby.RubyNil cannot be cast to org.jruby.RubyMatchData from RuntimeHelpers.java:2440:in `match2AndUpdateScope19' from -:3:in `_ file _' from -:-1:in `load' from Ruby.java:697:in `runScript' from Ruby.java:690:in `runScript' from Ruby.java:597:in `runNormally' from Ruby.java:446:in `runFromMain' from Main.java:369:in `doRunFromMain' from Main.java:258:in `internalRun' from Main.java:224:in `run' from Main.java:208:in `run' from Main.java:188:in `main'
        Hide
        Charles Oliver Nutter added a comment -

        Still fails on master; reopening.

        Show
        Charles Oliver Nutter added a comment - Still fails on master; reopening.
        Hide
        Charles Oliver Nutter added a comment -
        system ~/projects/jruby $ jruby -v
        jruby 1.7.0.dev (ruby-1.9.3-p139) (2012-03-17 1f0a4c3) (OpenJDK 64-Bit Server VM 1.7.0-u4-b13) [darwin-amd64-java]
        
        system ~/projects/jruby $ jruby blah.rb
        1.7.0.dev
        1.9.3
        RuntimeHelpers.java:2479:in `updateScopeWithCaptures': java.lang.ClassCastException: org.jruby.RubyNil cannot be cast to org.jruby.RubyMatchData
        	from RuntimeHelpers.java:2466:in `match2AndUpdateScope19'
        	from blah.rb:3:in `__file__'
        	from blah.rb:-1:in `load'
        	from Ruby.java:768:in `runScript'
        	from Ruby.java:761:in `runScript'
        	from Ruby.java:646:in `runNormally'
        	from Ruby.java:495:in `runFromMain'
        	from Main.java:375:in `doRunFromMain'
        	from Main.java:264:in `internalRun'
        	from Main.java:230:in `run'
        	from Main.java:214:in `run'
        	from Main.java:194:in `main'
        
        Show
        Charles Oliver Nutter added a comment - system ~/projects/jruby $ jruby -v jruby 1.7.0.dev (ruby-1.9.3-p139) (2012-03-17 1f0a4c3) (OpenJDK 64-Bit Server VM 1.7.0-u4-b13) [darwin-amd64-java] system ~/projects/jruby $ jruby blah.rb 1.7.0.dev 1.9.3 RuntimeHelpers.java:2479:in `updateScopeWithCaptures': java.lang.ClassCastException: org.jruby.RubyNil cannot be cast to org.jruby.RubyMatchData from RuntimeHelpers.java:2466:in `match2AndUpdateScope19' from blah.rb:3:in `__file__' from blah.rb:-1:in `load' from Ruby.java:768:in `runScript' from Ruby.java:761:in `runScript' from Ruby.java:646:in `runNormally' from Ruby.java:495:in `runFromMain' from Main.java:375:in `doRunFromMain' from Main.java:264:in `internalRun' from Main.java:230:in `run' from Main.java:214:in `run' from Main.java:194:in `main'
        Hide
        Charles Oliver Nutter added a comment -

        Only affects compiled mode.

        Show
        Charles Oliver Nutter added a comment - Only affects compiled mode.
        Hide
        Charles Oliver Nutter added a comment -

        Fixed on master.

        commit 0723b7d750b01ba0b7f69f71040b8f4cca7a7abf
        Author: Charles Oliver Nutter <headius@headius.com>
        Date:   Mon Apr 2 08:52:14 2012 -0500
        
            Fix JRUBY-5863: Named captures cause crash when there is no match
            
            Compiler calls match2AndUpdateScope[19], which did not pass through
            the match result and instead fell back to logic that used the
            scope's match and assumed it was non-nill.
        
        commit f031f631fbb1f64a87ef3a772ba39cce32dd256a
        Author: Charles Oliver Nutter <headius@headius.com>
        Date:   Mon Apr 2 08:59:05 2012 -0500
        
            Test for JRUBY-5863.
        
        Show
        Charles Oliver Nutter added a comment - Fixed on master. commit 0723b7d750b01ba0b7f69f71040b8f4cca7a7abf Author: Charles Oliver Nutter <headius@headius.com> Date: Mon Apr 2 08:52:14 2012 -0500 Fix JRUBY-5863: Named captures cause crash when there is no match Compiler calls match2AndUpdateScope[19], which did not pass through the match result and instead fell back to logic that used the scope's match and assumed it was non-nill. commit f031f631fbb1f64a87ef3a772ba39cce32dd256a Author: Charles Oliver Nutter <headius@headius.com> Date: Mon Apr 2 08:59:05 2012 -0500 Test for JRUBY-5863.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Gabor Szarka
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: