Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.5.5, JRuby 1.5.6
    • Fix Version/s: JRuby 1.6RC2
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      gem list | grep rspec:

      rspec (2.3.0)
      rspec-core (2.3.1)
      rspec-expectations (2.3.0)
      rspec-mocks (2.3.0)
      rspec-rails (2.3.1)
      

      npe.rb:

      describe true do
        around(:each) do |example|
          example.run
        end
      
        it "is true" do
          true.should be_true
        end
      end
      

      rspec npe.rb:

      F
      
      Failures:
      
        1) true is true
           Failure/Error: Unable to find matching line from backtrace
      /Users/jfire/.rvm/gems/jruby-1.5.6/gems/rspec-core-2.3.1/lib/rspec/core/formatters/base_text_formatter.rb:150:in `dump_failure': private method `split' called for nil:NilClass (NoMethodError)
      	from /Users/jfire/.rvm/gems/jruby-1.5.6/gems/rspec-core-2.3.1/lib/rspec/core/formatters/base_text_formatter.rb:19:in `dump_failures'
      	from /Users/jfire/.rvm/gems/jruby-1.5.6/gems/rspec-core-2.3.1/lib/rspec/core/formatters/base_text_formatter.rb:17:in `each'
      	from /Users/jfire/.rvm/gems/jruby-1.5.6/gems/rspec-core-2.3.1/lib/rspec/core/formatters/base_text_formatter.rb:17:in `each_with_index'
      	from /Users/jfire/.rvm/gems/jruby-1.5.6/gems/rspec-core-2.3.1/lib/rspec/core/formatters/base_text_formatter.rb:17:in `dump_failures'
      	from /Users/jfire/.rvm/gems/jruby-1.5.6/gems/rspec-core-2.3.1/lib/rspec/core/reporter.rb:75:in `notify'
      	from /Users/jfire/.rvm/gems/jruby-1.5.6/gems/rspec-core-2.3.1/lib/rspec/core/reporter.rb:74:in `each'
      	from /Users/jfire/.rvm/gems/jruby-1.5.6/gems/rspec-core-2.3.1/lib/rspec/core/reporter.rb:74:in `notify'
      	from /Users/jfire/.rvm/gems/jruby-1.5.6/gems/rspec-core-2.3.1/lib/rspec/core/reporter.rb:23:in `conclude'
      	from /Users/jfire/.rvm/gems/jruby-1.5.6/gems/rspec-core-2.3.1/lib/rspec/core/reporter.rb:14:in `report'
      	from /Users/jfire/.rvm/gems/jruby-1.5.6/gems/rspec-core-2.3.1/lib/rspec/core/command_line.rb:24:in `run'
      	from /Users/jfire/.rvm/gems/jruby-1.5.6/gems/rspec-core-2.3.1/lib/rspec/core/runner.rb:55:in `run_in_process'
      	from /Users/jfire/.rvm/gems/jruby-1.5.6/gems/rspec-core-2.3.1/lib/rspec/core/runner.rb:46:in `run'
      	from /Users/jfire/.rvm/gems/jruby-1.5.6/gems/rspec-core-2.3.1/lib/rspec/core/runner.rb:10:in `autorun'
      	from :1
      

      If you debug this, you'll find that the exception that the formatter is trying to dump is a NPE with the following stack trace:

      org.jruby.runtime.Block.cloneBlock(Block.java:226)
      org.jruby.RubyProc.call(RubyProc.java:218)
      org.jruby.RubyProc.call(RubyProc.java:203)
      sun.reflect.GeneratedMethodAccessor128.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:597)
      org.jruby.internal.runtime.methods.ReflectedJavaMethod.call(ReflectedJavaMethod.java:150)
      org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:182)
      org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:178)
      org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:289)
      org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:108)
      org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:61)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.IfNode.interpret(IfNode.java:119)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:160)
      org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:299)
      org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:117)
      org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:132)
      org.jruby.ast.FCallNoArgBlockNode.interpret(FCallNoArgBlockNode.java:32)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:373)
      org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:294)
      org.jruby.runtime.InterpretedBlock.yieldSpecific(InterpretedBlock.java:228)
      org.jruby.runtime.Block.yieldSpecific(Block.java:99)
      org.jruby.ast.ZYieldNode.interpret(ZYieldNode.java:25)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
      org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:373)
      org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:346)
      org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:303)
      org.jruby.runtime.Block.yield(Block.java:194)
      org.jruby.RubyContinuation.enter(RubyContinuation.java:106)
      org.jruby.RubyKernel.rbCatch(RubyKernel.java:1093)
      sun.reflect.GeneratedMethodAccessor154.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:597)
      org.jruby.internal.runtime.methods.ReflectedJavaMethod.call(ReflectedJavaMethod.java:148)
      org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:190)
      org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:319)
      org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:157)
      org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:172)
      org.jruby.ast.FCallOneArgBlockNode.interpret(FCallOneArgBlockNode.java:34)
      org.jruby.ast.InstAsgnNode.interpret(InstAsgnNode.java:95)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:160)
      org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:299)
      org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:117)
      org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:132)
      org.jruby.ast.FCallNoArgBlockNode.interpret(FCallNoArgBlockNode.java:32)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.IfNode.interpret(IfNode.java:119)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.RescueNode.executeBody(RescueNode.java:199)
      org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:118)
      org.jruby.ast.RescueNode.interpret(RescueNode.java:110)
      org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96)
      org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
      org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:221)
      org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:329)
      org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:188)
      org.jruby.ast.CallTwoArgNode.interpret(CallTwoArgNode.java:59)
      org.jruby.ast.DAsgnNode.interpret(DAsgnNode.java:110)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
      org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:373)
      org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:346)
      org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:303)
      org.jruby.runtime.Block.yield(Block.java:194)
      org.jruby.RubyArray.collect(RubyArray.java:2354)
      sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:597)
      org.jruby.internal.runtime.methods.ReflectedJavaMethod.call(ReflectedJavaMethod.java:150)
      org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:182)
      org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:115)
      org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:122)
      org.jruby.ast.CallNoArgBlockNode.interpret(CallNoArgBlockNode.java:64)
      org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:61)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:180)
      org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:309)
      org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:148)
      org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
      org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
      org.jruby.ast.RescueNode.executeBody(RescueNode.java:199)
      org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:118)
      org.jruby.ast.RescueNode.interpret(RescueNode.java:110)
      org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96)
      org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
      org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:180)
      org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:309)
      org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:148)
      org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:373)
      org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:346)
      org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:303)
      org.jruby.runtime.Block.yield(Block.java:194)
      org.jruby.RubyArray.collect(RubyArray.java:2354)
      sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:597)
      org.jruby.internal.runtime.methods.ReflectedJavaMethod.call(ReflectedJavaMethod.java:150)
      org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:182)
      org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:115)
      org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:122)
      org.jruby.ast.CallNoArgBlockNode.interpret(CallNoArgBlockNode.java:64)
      org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:61)
      org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
      org.jruby.ast.RescueNode.executeBody(RescueNode.java:199)
      org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:118)
      org.jruby.ast.RescueNode.interpret(RescueNode.java:110)
      org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96)
      org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
      org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:180)
      org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:309)
      org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:148)
      org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:373)
      org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:346)
      org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:303)
      org.jruby.runtime.Block.yield(Block.java:194)
      org.jruby.RubyArray.collect(RubyArray.java:2354)
      sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:597)
      org.jruby.internal.runtime.methods.ReflectedJavaMethod.call(ReflectedJavaMethod.java:150)
      org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:182)
      org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:299)
      org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:117)
      org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:122)
      org.jruby.ast.CallNoArgBlockNode.interpret(CallNoArgBlockNode.java:64)
      org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:61)
      org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
      org.jruby.ast.RescueNode.executeBody(RescueNode.java:199)
      org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:118)
      org.jruby.ast.RescueNode.interpret(RescueNode.java:110)
      org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96)
      org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
      org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:180)
      org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:309)
      org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:148)
      org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:373)
      org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:346)
      org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:303)
      org.jruby.runtime.Block.yield(Block.java:194)
      org.jruby.RubyArray.collect(RubyArray.java:2354)
      sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:597)
      org.jruby.internal.runtime.methods.ReflectedJavaMethod.call(ReflectedJavaMethod.java:150)
      org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:182)
      org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:299)
      org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:117)
      org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:122)
      org.jruby.ast.CallNoArgBlockNode.interpret(CallNoArgBlockNode.java:64)
      org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:61)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
      org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96)
      org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:373)
      org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:346)
      org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:303)
      org.jruby.runtime.Block.yield(Block.java:194)
      org.jruby.ast.YieldNode.interpret(YieldNode.java:112)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96)
      org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
      org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:201)
      org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:319)
      org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:157)
      org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:162)
      org.jruby.ast.CallOneArgBlockNode.interpret(CallOneArgBlockNode.java:60)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
      org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:221)
      org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:329)
      org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:188)
      org.jruby.ast.CallTwoArgNode.interpret(CallTwoArgNode.java:59)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:262)
      org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:349)
      org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:228)
      org.jruby.ast.FCallThreeArgNode.interpret(FCallThreeArgNode.java:40)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.IfNode.interpret(IfNode.java:119)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
      org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:262)
      org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:349)
      org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:228)
      org.jruby.ast.FCallThreeArgNode.interpret(FCallThreeArgNode.java:40)
      org.jruby.ast.IfNode.interpret(IfNode.java:111)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:373)
      org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:327)
      org.jruby.runtime.BlockBody.call(BlockBody.java:78)
      org.jruby.runtime.Block.call(Block.java:89)
      org.jruby.RubyProc.call(RubyProc.java:224)
      org.jruby.RubyProc.call(RubyProc.java:207)
      org.jruby.Ruby.tearDown(Ruby.java:2808)
      org.jruby.Ruby.tearDown(Ruby.java:2795)
      org.jruby.debug.Debugger.stop(Debugger.java:105)
      org.jruby.debug.Debugger.load(Debugger.java:139)
      org.jruby.debug.RubyDebugger.debug_load(RubyDebugger.java:207)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:597)
      org.jruby.internal.runtime.methods.ReflectedJavaMethod.call(ReflectedJavaMethod.java:148)
      org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:206)
      org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:202)
      org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:349)
      org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:228)
      org.jruby.ast.FCallThreeArgNode.interpret(FCallThreeArgNode.java:40)
      org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
      org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:180)
      org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:309)
      org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:148)
      org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
      org.jruby.ast.RootNode.interpret(RootNode.java:129)
      org.jruby.Ruby.loadFile(Ruby.java:2551)
      org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:61)
      org.jruby.runtime.load.LoadService.load(LoadService.java:255)
      org.jruby.RubyKernel.loadCommon(RubyKernel.java:1010)
      org.jruby.RubyKernel.load(RubyKernel.java:992)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:597)
      org.jruby.internal.runtime.methods.ReflectedJavaMethod.call(ReflectedJavaMethod.java:148)
      org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:190)
      org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:186)
      org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:309)
      org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:148)
      org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
      org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
      org.jruby.ast.RootNode.interpret(RootNode.java:129)
      org.jruby.Ruby.runInterpreter(Ruby.java:716)
      org.jruby.Ruby.runNormally(Ruby.java:577)
      org.jruby.Ruby.runFromMain(Ruby.java:416)
      org.jruby.Main.run(Main.java:286)
      org.jruby.Main.run(Main.java:128)
      org.jruby.Main.main(Main.java:97)
      

      This is originally thrown from around rspec/code/example_group.rb:182. That's about as far as I could get with it.

        Activity

        Hide
        John Firebaugh added a comment -

        This is the commit that appears to have triggered the bug:

        https://github.com/rspec/rspec-core/commit/b6a7897ef7e105a77984db2a0ece81cf967678a2

        Show
        John Firebaugh added a comment - This is the commit that appears to have triggered the bug: https://github.com/rspec/rspec-core/commit/b6a7897ef7e105a77984db2a0ece81cf967678a2
        Hide
        John Firebaugh added a comment -

        Reduced test case:

        class Procsy < Proc
          def initialize
          end
        end
        
        def procsy
          Procsy.new
        end
        
        puts procsy { "hello" }.call
        

        MRI prints "hello", JRuby NPEs.

        Show
        John Firebaugh added a comment - Reduced test case: class Procsy < Proc def initialize end end def procsy Procsy. new end puts procsy { "hello" }.call MRI prints "hello", JRuby NPEs.
        Hide
        John Firebaugh added a comment -

        So MRI allows the Proc to bind to the implicit block even though the subclass's #initialize doesn't call super. There's no rubyspec for this (very strange, IMHO) MRI behavior. I guess it prevents you from creating a blockless Proc.

        Show
        John Firebaugh added a comment - So MRI allows the Proc to bind to the implicit block even though the subclass's #initialize doesn't call super. There's no rubyspec for this (very strange, IMHO) MRI behavior. I guess it prevents you from creating a blockless Proc.
        Hide
        Charles Oliver Nutter added a comment -

        We'll want to mimic the MRI behavior. I suppose they initialize the proc's binding in allocate rather than in initialize; that shouldn't be hard to duplicate in RubyProc constructor.

        Show
        Charles Oliver Nutter added a comment - We'll want to mimic the MRI behavior. I suppose they initialize the proc's binding in allocate rather than in initialize; that shouldn't be hard to duplicate in RubyProc constructor.
        Hide
        Charles Oliver Nutter added a comment -

        Trivial reproduction:

        ~/projects/jruby &#10132; jruby -e "class Prak < Proc; def initialize; end; end; Prak.new { }.call"
        Block.java:162:in `cloneBlock': java.lang.NullPointerException
        	from RubyProc.java:273:in `call'
        	from RubyProc.java:239:in `call'
        	from org/jruby/RubyProc$i_method_0_0$RUBYINVOKER$call.gen:65535:in `call'
        	from DynamicMethod.java:200:in `call'
        	from DynamicMethod.java:196:in `call'
        	from CachingCallSite.java:262:in `cacheAndCall'
        	from CachingCallSite.java:105:in `call'
        	from -e:1:in `__file__'
        	from -e:-1:in `load'
        	from Ruby.java:699:in `runScript'
        	from Ruby.java:584:in `runNormally'
        	from Ruby.java:419:in `runFromMain'
        	from Main.java:304:in `run'
        	from Main.java:144:in `run'
        	from Main.java:113:in `main'
        
        Show
        Charles Oliver Nutter added a comment - Trivial reproduction: ~/projects/jruby &#10132; jruby -e "class Prak < Proc; def initialize; end; end; Prak.new { }.call" Block.java:162:in `cloneBlock': java.lang.NullPointerException from RubyProc.java:273:in `call' from RubyProc.java:239:in `call' from org/jruby/RubyProc$i_method_0_0$RUBYINVOKER$call.gen:65535:in `call' from DynamicMethod.java:200:in `call' from DynamicMethod.java:196:in `call' from CachingCallSite.java:262:in `cacheAndCall' from CachingCallSite.java:105:in `call' from -e:1:in `__file__' from -e:-1:in `load' from Ruby.java:699:in `runScript' from Ruby.java:584:in `runNormally' from Ruby.java:419:in `runFromMain' from Main.java:304:in `run' from Main.java:144:in `run' from Main.java:113:in `main'
        Hide
        Charles Oliver Nutter added a comment -

        Thanks for the report! It turns out that MRI doesn't even define Proc#initialize and basically does all the setup in Proc.new. I modified our logic to do the same thing.

        commit 01e4d770efddad773d0e52c2a2e0312bdf7cb660
        Author: Charles Oliver Nutter <headius@headius.com>
        Date: Fri Dec 31 16:14:05 2010 -0600

        Fix JRUBY-5261: RSpec >= 2.2 around hooks trigger runtime NPE

        • MRI initializes the block reference in a proc during Proc.new, and does nothing in the base Proc#initialize.
        Show
        Charles Oliver Nutter added a comment - Thanks for the report! It turns out that MRI doesn't even define Proc#initialize and basically does all the setup in Proc.new. I modified our logic to do the same thing. commit 01e4d770efddad773d0e52c2a2e0312bdf7cb660 Author: Charles Oliver Nutter <headius@headius.com> Date: Fri Dec 31 16:14:05 2010 -0600 Fix JRUBY-5261 : RSpec >= 2.2 around hooks trigger runtime NPE MRI initializes the block reference in a proc during Proc.new, and does nothing in the base Proc#initialize.
        Hide
        Charles Oliver Nutter added a comment -

        RubySpec added as well:

        commit afa5b0be445f17e719ce72b1e7bb170ea841c0b5
        Author: Charles Oliver Nutter <headius@headius.com>
        Date: Fri Dec 31 16:29:04 2010 -0600

        Add spec for Proc subclass that does not 'super' in 'initialize' (JRUBY-5261)

        Show
        Charles Oliver Nutter added a comment - RubySpec added as well: commit afa5b0be445f17e719ce72b1e7bb170ea841c0b5 Author: Charles Oliver Nutter <headius@headius.com> Date: Fri Dec 31 16:29:04 2010 -0600 Add spec for Proc subclass that does not 'super' in 'initialize' ( JRUBY-5261 )
        Hide
        John Firebaugh added a comment - - edited

        This is not correctly fixed in 1.6.0rc1; my test case above now raises: org/jruby/RubyProc.java:149:in `newInstance': tried to create Proc object without a block (ArgumentError)

        Show
        John Firebaugh added a comment - - edited This is not correctly fixed in 1.6.0rc1; my test case above now raises: org/jruby/RubyProc.java:149:in `newInstance': tried to create Proc object without a block (ArgumentError)
        Hide
        John Firebaugh added a comment -

        Not fixed in 1.6.0rc1 – RSpec around blocks still trigger a fatal error (albeit no longer an NPE).

        Show
        John Firebaugh added a comment - Not fixed in 1.6.0rc1 – RSpec around blocks still trigger a fatal error (albeit no longer an NPE).
        Hide
        Charles Oliver Nutter added a comment -

        I'm confused...your spec from the description does work properly on master, and the commit should have been in 1.6.0.RC1. Can you re-test JRuby master from a snapshot, from http://ci.jruby.org/snapshots please?

        Marking for RC2.

        Show
        Charles Oliver Nutter added a comment - I'm confused...your spec from the description does work properly on master, and the commit should have been in 1.6.0.RC1. Can you re-test JRuby master from a snapshot, from http://ci.jruby.org/snapshots please? Marking for RC2.
        Hide
        John Firebaugh added a comment -

        Sorry, I was referring to the reduced testcase:

        class Procsy < Proc
          def initialize
          end
        end
        
        def procsy
          Procsy.new
        end
        
        puts procsy { "hello" }.call
        

        This is failing on 1.6.0.RC1. Will test on a snapshot too; waiting for it to build.

        Show
        John Firebaugh added a comment - Sorry, I was referring to the reduced testcase: class Procsy < Proc def initialize end end def procsy Procsy. new end puts procsy { "hello" }.call This is failing on 1.6.0.RC1. Will test on a snapshot too; waiting for it to build.
        Hide
        John Firebaugh added a comment -
        &#9775;&#12320; ruby -v
        jruby 1.6.0.RC1 (ruby 1.8.7 patchlevel 330) (2011-01-24 75ced7c) (Java HotSpot(TM) Client VM 1.6.0_22) [darwin-i386-java]
        &#9775;&#12320; ruby scratch/proc_new.rb 
        org/jruby/RubyProc.java:149:in `newInstance': tried to create Proc object without a block (ArgumentError)
        	from scratch/proc_new.rb:8:in `procsy'
        	from scratch/proc_new.rb:11:in `(root)'
        
        Show
        John Firebaugh added a comment - &#9775;&#12320; ruby -v jruby 1.6.0.RC1 (ruby 1.8.7 patchlevel 330) (2011-01-24 75ced7c) (Java HotSpot(TM) Client VM 1.6.0_22) [darwin-i386-java] &#9775;&#12320; ruby scratch/proc_new.rb org/jruby/RubyProc.java:149:in `newInstance': tried to create Proc object without a block (ArgumentError) from scratch/proc_new.rb:8:in `procsy' from scratch/proc_new.rb:11:in `(root)'
        Hide
        Hiro Asari added a comment -

        John,

        Why is that a reduction? procsy is just calling Procsy.new, which is indeed a call to create a Proc without a block. You need to pass the block on to Procsy.new if you want to create a Proc.

        procsy.rb
        class Procsy < Proc
        end
        
        def procsy(&block)
         Procsy.new(&block)
        end
        
        puts procsy { "hello" }.call
        
        Show
        Hiro Asari added a comment - John, Why is that a reduction? procsy is just calling Procsy.new , which is indeed a call to create a Proc without a block. You need to pass the block on to Procsy.new if you want to create a Proc. procsy.rb class Procsy < Proc end def procsy(&block) Procsy. new (&block) end puts procsy { "hello" }.call
        Hide
        John Firebaugh added a comment -

        The code does not raise an ArgumentError in MRI.

        When called without a block argument, Proc.new binds to the implicit block parameter. Apparently MRI supports that behavior with Proc subclasses as well – JRuby should behave the same.

        Show
        John Firebaugh added a comment - The code does not raise an ArgumentError in MRI. When called without a block argument, Proc.new binds to the implicit block parameter. Apparently MRI supports that behavior with Proc subclasses as well – JRuby should behave the same.
        Hide
        Hiro Asari added a comment -

        John,

        Thank you for the clarification.

        Show
        Hiro Asari added a comment - John, Thank you for the clarification.
        Hide
        Hiro Asari added a comment -

        Interestingly, the code works fine in IRB:

        $ jruby -v -e 'class P < Proc; def initialize; end; end; def f; P.new; end; f {"hello"}.call'
        jruby 1.6.0.RC1 (ruby 1.8.7 patchlevel 330) (2011-01-24 406556b) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_22) [darwin-x86_64-java]
        org/jruby/RubyProc.java:141:in `newInstance': tried to create Proc object without a block (ArgumentError)
        	from -e:1:in `f'
        	from -e:1:in `(root)'
        
        $ jruby -S irb
        irb(main):001:0> class P < Proc; def initialize; end; end
        => nil
        irb(main):002:0> P.new {"hello"}.call
        => "hello"
        irb(main):003:0> def f; P.new; end
        => nil
        irb(main):004:0> f {"hello"}
        => #<Proc:0x20ec6bb1@(irb):4>
        irb(main):005:0> f {"hello"}.call
        => "hello"
        

        Although, in MRI, f {"hello"} returns a P object.

        Show
        Hiro Asari added a comment - Interestingly, the code works fine in IRB: $ jruby -v -e 'class P < Proc; def initialize; end; end; def f; P.new; end; f {"hello"}.call' jruby 1.6.0.RC1 (ruby 1.8.7 patchlevel 330) (2011-01-24 406556b) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_22) [darwin-x86_64-java] org/jruby/RubyProc.java:141:in `newInstance': tried to create Proc object without a block (ArgumentError) from -e:1:in `f' from -e:1:in `(root)' $ jruby -S irb irb(main):001:0> class P < Proc; def initialize; end; end => nil irb(main):002:0> P.new {"hello"}.call => "hello" irb(main):003:0> def f; P.new; end => nil irb(main):004:0> f {"hello"} => #<Proc:0x20ec6bb1@(irb):4> irb(main):005:0> f {"hello"}.call => "hello" Although, in MRI, f {"hello" } returns a P object.
        Hide
        Hiro Asari added a comment -

        I'm resolving this again; the original issue with RSpec is resolved.

        The issue John raises is an interesting one, but it does not affect RSpec and should be dealt with in a separate ticket.

        Show
        Hiro Asari added a comment - I'm resolving this again; the original issue with RSpec is resolved. The issue John raises is an interesting one, but it does not affect RSpec and should be dealt with in a separate ticket.
        Hide
        Charles Oliver Nutter added a comment -

        John: See JRUBY-5420. The additional case you came up with is a very special, very dark corner of Ruby that JRuby does not support in 1.6+ because of the large amount of magic involved.

        Show
        Charles Oliver Nutter added a comment - John: See JRUBY-5420 . The additional case you came up with is a very special, very dark corner of Ruby that JRuby does not support in 1.6+ because of the large amount of magic involved.
        Hide
        John Firebaugh added a comment -

        Thanks for the detailed explanation at JRUBY-5420 Charles.

        Unfortunately RSpec around hooks do still currently rely on that magic behavior – I'm getting the ArgumentError when I try to run my specs under JRuby head (+ RSpec 2.4). I'm not sure why the RSpec test case in the original description doesn't trigger it, and I haven't been able to boil down a small test case, but you can see the same pattern as isolated above, here in the RSpec codebase: https://github.com/rspec/rspec-core/blob/master/lib/rspec/core/example.rb#L100

        It sounds like the solution at this point is to submit a pull request to RSpec to always pass explicit block parameters rather than relying on the implicit Proc.new behavior.

        Show
        John Firebaugh added a comment - Thanks for the detailed explanation at JRUBY-5420 Charles. Unfortunately RSpec around hooks do still currently rely on that magic behavior – I'm getting the ArgumentError when I try to run my specs under JRuby head (+ RSpec 2.4). I'm not sure why the RSpec test case in the original description doesn't trigger it, and I haven't been able to boil down a small test case, but you can see the same pattern as isolated above, here in the RSpec codebase: https://github.com/rspec/rspec-core/blob/master/lib/rspec/core/example.rb#L100 It sounds like the solution at this point is to submit a pull request to RSpec to always pass explicit block parameters rather than relying on the implicit Proc.new behavior.
        Hide
        John Firebaugh added a comment -
        Show
        John Firebaugh added a comment - RSpec pull request: https://github.com/rspec/rspec-core/pull/291
        Hide
        John Firebaugh added a comment -

        Unfortunately, the change to RSpec fixes the problem on 1.6 but triggers another bug on 1.5.6.

        
        class Procsy < Proc
          attr_reader :foo
          def initialize(foo)
            @foo = foo
          end
        end
        
        def procsy(&block)
          Procsy.new("foo", &block)
        end
        
        puts procsy { "hello" }.foo
        

        Output should be "foo", but 1.5.6 triggers "undefined method `foo' for #<Proc:0x15b0e2c@scratch/proc_new.rb:12> (NoMethodError)"

        Show
        John Firebaugh added a comment - Unfortunately, the change to RSpec fixes the problem on 1.6 but triggers another bug on 1.5.6. class Procsy < Proc attr_reader :foo def initialize(foo) @foo = foo end end def procsy(&block) Procsy. new ( "foo" , &block) end puts procsy { "hello" }.foo Output should be "foo", but 1.5.6 triggers "undefined method `foo' for #<Proc:0x15b0e2c@scratch/proc_new.rb:12> (NoMethodError)"
        Hide
        John Firebaugh added a comment -

        Looks like that's probably JRUBY-5026.

        Show
        John Firebaugh added a comment - Looks like that's probably JRUBY-5026 .
        Hide
        David Chelimsky added a comment -

        This means that RSpec has to load different code for JRuby >= 1.6 and < 1.6.

        Any chance 5026 would get back-ported to the 1.5 series? If not, how do you recommend RSpec tests for the version?

        Show
        David Chelimsky added a comment - This means that RSpec has to load different code for JRuby >= 1.6 and < 1.6. Any chance 5026 would get back-ported to the 1.5 series? If not, how do you recommend RSpec tests for the version?
        Hide
        Hiro Asari added a comment -

        David,

        There is no plan for another 1.5.x release. (It could change, but I won't bet on it.)

        You can look at the constant JRUBY_VERSION for the JRuby version at run-time.

        Show
        Hiro Asari added a comment - David, There is no plan for another 1.5.x release. (It could change, but I won't bet on it.) You can look at the constant JRUBY_VERSION for the JRuby version at run-time.
        Hide
        David Chelimsky added a comment -

        Thanks Hiro. I implemented it a bit differently after a suggestion from John Firebaugh, so don't need to switch on JRuby versions.

        Show
        David Chelimsky added a comment - Thanks Hiro. I implemented it a bit differently after a suggestion from John Firebaugh, so don't need to switch on JRuby versions.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: