CCE using proc{} in AR callbacks
--------------------------------

                 Key: JRUBY-2849
                 URL: http://jira.codehaus.org/browse/JRUBY-2849
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1.2
         Environment: 32 bit linux
            Reporter: McClain Looney


Whatever was causing it, changing proc {..} to Proc.new{..} in the below code 
fixed the issue:

  has_many :foo, :bar=>:destroy, :as=>:baz, :before_add=>Proc.new{|me, foo| 
      do_stuff()
  }


stack trace:

java.lang.ClassCastException: org.jruby.RubyArray
        at 
org.jruby.evaluator.ASTInterpreter.rescueNode(ASTInterpreter.java:1581)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:468)
        at 
org.jruby.evaluator.ASTInterpreter.ensureNode(ASTInterpreter.java:1086)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:364)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:620)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:318)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:174)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:150)
        at 
org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:96)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:91)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:278)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:675)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:324)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:150)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:115)
        at org.jruby.runtime.Block.yield(Block.java:109)
        at org.jruby.RubyArray.each(RubyArray.java:1311)
        at org.jruby.RubyArrayInvoker$each_method_0_0.call(Unknown Source)
        at 
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:295)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:91)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:278)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:675)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:324)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:620)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:318)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:174)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:150)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:91)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:278)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:675)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:324)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:150)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:115)
        at org.jruby.runtime.Block.yield(Block.java:109)
        at org.jruby.RubyArray.each(RubyArray.java:1311)
        at org.jruby.RubyArrayInvoker$each_method_0_0.call(Unknown Source)
        at 
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:295)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:91)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:278)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:675)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:324)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:620)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:318)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:174)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:150)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:91)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:278)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:675)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:324)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:620)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:318)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:174)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:150)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:204)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:107)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:264)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:670)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:324)
        at 
org.jruby.evaluator.ASTInterpreter.returnNode(ASTInterpreter.java:1628)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:472)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:174)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:150)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:225)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:123)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:298)
        at 
org.jruby.evaluator.ASTInterpreter.vcallNode(ASTInterpreter.java:1781)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:500)
        at 
org.jruby.evaluator.ASTInterpreter.returnNode(ASTInterpreter.java:1628)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:472)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:620)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:318)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:174)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:150)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:204)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:107)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:264)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:670)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:324)
        at 
org.jruby.evaluator.ASTInterpreter.returnNode(ASTInterpreter.java:1628)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:472)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:174)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:150)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:309)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:187)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:366)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:653)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:324)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:637)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:324)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:620)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:318)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:174)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:150)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:204)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:107)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:264)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:670)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:324)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:620)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:318)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:174)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:150)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:204)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:107)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:264)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:670)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:324)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1115)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:370)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:150)
        at org.jruby.runtime.InterpretedBlock.call(InterpretedBlock.java:103)
        at org.jruby.runtime.Block.call(Block.java:105)
        at org.jruby.RubyProc.call(RubyProc.java:204)
        at org.jruby.RubyProc.call(RubyProc.java:189)
        at org.jruby.Ruby.tearDown(Ruby.java:2197)
        at org.jruby.Main.run(Main.java:146)
        at org.jruby.Main.run(Main.java:89)
        at 
org.jruby.util.ShellLauncher$ScriptThreadProcess.run(ShellLauncher.java:86)
        at java.lang.Thread.run(Thread.java:595)



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to