Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.7.0.pre2
    • Fix Version/s: JRuby 1.7.0.RC1
    • Component/s: Ruby 1.9.3
    • Labels:
      None
    • Number of attachments :
      0

      Description

      require 'prime'
      
      # FAILS:
      p Prime.each(3).reduce(:+)  == 5
      p Prime.each(3).reduce(0, :+)  == 5
      
      # Issue seems to be connected with Enumerator
      p Enumerator.new{|y| y << 1}.reduce(:+) == 1
      p Enumerator.new{|y| y << 1}.reduce(0, :+) == 1
      
      
      =begin
      
      # WORKS
      jruby-1.7.0.preview2 :001 > Enumerator.new{|y| y << 1}.reduce{|sum, n| sum + n}
       => 1 
      jruby-1.7.0.preview2 :002 > Enumerator.new{|y| y << 1}.reduce(0){|sum, n| sum + n}
       => 1
      
      # FAILS
      jruby-1.7.0.preview2 :003 > Enumerator.new{|y| y << 1}.reduce(:+)
       => nil 
      jruby-1.7.0.preview2 :004 > Enumerator.new{|y| y << 1}.reduce(0, :+)
      Java::JavaLang::NullPointerException: 
      	from org.jruby.RubyNumeric.coerceBody(RubyNumeric.java:447)
      	from org.jruby.RubyNumeric.doCoerce(RubyNumeric.java:456)
      	from org.jruby.RubyNumeric.coerceBin(RubyNumeric.java:478)
      	from org.jruby.RubyFixnum.addOther(RubyFixnum.java:407)
      	from org.jruby.RubyFixnum.op_plus(RubyFixnum.java:347)
      	from org.jruby.RubyFixnum$INVOKER$i$1$0$op_plus.call(RubyFixnum$INVOKER$i$1$0$op_plus.gen)
      	from org.jruby.RubyClass.finvoke(RubyClass.java:749)
      	from org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:540)
      	from org.jruby.RubyBasicObject.callMethod(RubyBasicObject.java:361)
      	from org.jruby.RubyEnumerable$26.call(RubyEnumerable.java:832)
      	from org.jruby.runtime.CallBlock.call(CallBlock.java:66)
      	from org.jruby.runtime.Block.call(Block.java:89)
      	from org.jruby.RubyProc.call(RubyProc.java:271)
      	from org.jruby.RubyProc.call19(RubyProc.java:259)
      	from org.jruby.RubyYielder.yield(RubyYielder.java:86)
      	from org.jruby.RubyYielder.op_lshift(RubyYielder.java:94)
      ... 149 levels...
      	from org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
      	from org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
      	from org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:192)
      	from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:312)
      	from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:169)
      	from Users.aa.$_dot_rvm.rubies.jruby_minus_1_dot_7_dot_0_dot_preview2.bin.irb.__file__(/Users/aa/.rvm/rubies/jruby-1.7.0.preview2/bin/irb:17)
      	from Users.aa.$_dot_rvm.rubies.jruby_minus_1_dot_7_dot_0_dot_preview2.bin.irb.load(/Users/aa/.rvm/rubies/jruby-1.7.0.preview2/bin/irb)
      	from org.jruby.Ruby.runScript(Ruby.java:780)
      	from org.jruby.Ruby.runScript(Ruby.java:773)
      	from org.jruby.Ruby.runNormally(Ruby.java:650)
      	from org.jruby.Ruby.runFromMain(Ruby.java:499)
      	from org.jruby.Main.doRunFromMain(Main.java:376)
      	from org.jruby.Main.internalRun(Main.java:265)
      	from org.jruby.Main.run(Main.java:231)
      	from org.jruby.Main.run(Main.java:215)
      	from org.jruby.Main.main(Main.java:195)
      
      =end
      

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        Appears to have been fixed in 1.7RC1.

        Show
        Charles Oliver Nutter added a comment - Appears to have been fixed in 1.7RC1.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Andreas A
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: