Const definition on non-class/module breaks JRuby hard
------------------------------------------------------

                 Key: JRUBY-2004
                 URL: http://jira.codehaus.org/browse/JRUBY-2004
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1RC1
         Environment: Latest JRuby 1.1RC1
            Reporter: Vladimir Sizikov
            Priority: Critical


Consider the following:

{noformat}
V = 3
V::Z = 5
{noformat}

MRI prints: TypeError: 3 is not a class/module

JRuby crashes:
Exception in thread "main" java.lang.ClassCastException: org.jruby.RubyFixnum 
cannot be cast to org.                                                          
                      jruby.RubyModule
        at 
org.jruby.evaluator.ASTInterpreter.constDeclNode(ASTInterpreter.java:837)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:316)
        at org.jruby.evaluator.ASTInterpreter.rootNode(ASTInterpreter.java:1598)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:449)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.evaluator.ASTInterpreter.evalWithBinding(ASTInterpreter.java:217)
        at org.jruby.RubyKernel.eval(RubyKernel.java:764)
        at org.jruby.RubyKernelInvoker$eval_method_1_3.call(Unknown Source)
        at org.jruby.runtime.CallSite$ICNonBlockCallSite.call(CallSite.java:169)
        at 
org.jruby.runtime.CallSite$ArgumentBoxingCallSite.call(CallSite.java:101)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1093)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:346)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:175)
        at org.jruby.runtime.CallSite$ICNonBlockCallSite.call(CallSite.java:169)
        at 
org.jruby.runtime.CallSite$ArgumentBoxingCallSite.call(CallSite.java:101)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:653)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:300)
        at 
org.jruby.evaluator.ASTInterpreter.setupArgs(ASTInterpreter.java:2137)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1088)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:346)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:627)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:294)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:175)
        at org.jruby.runtime.CallSite$ICNonBlockCallSite.call(CallSite.java:169)
        at 
org.jruby.runtime.CallSite$ArgumentBoxingCallSite.call(CallSite.java:101)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:653)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:300)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:627)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:294)
        at 
org.jruby.evaluator.ASTInterpreter.rescueNode(ASTInterpreter.java:1500)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:443)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:627)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:294)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:148)
        at org.jruby.runtime.Block.yield(Block.java:114)
        at 
org.jruby.evaluator.ASTInterpreter.yieldNode(ASTInterpreter.java:1800)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:484)
        at 
org.jruby.evaluator.ASTInterpreter.ensureNode(ASTInterpreter.java:1065)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:340)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:627)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:294)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:175)
        at org.jruby.runtime.CallSite$ICBlockCallSite.call(CallSite.java:187)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1098)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:346)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:148)
        at org.jruby.runtime.Block.yield(Block.java:114)
        at 
org.jruby.evaluator.ASTInterpreter.yieldNode(ASTInterpreter.java:1800)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:484)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:627)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:294)
        at 
org.jruby.evaluator.ASTInterpreter.rescueNode(ASTInterpreter.java:1500)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:443)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:148)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:113)
        at org.jruby.runtime.Block.yield(Block.java:109)
        at org.jruby.RubyKernel.loop(RubyKernel.java:955)
        at org.jruby.RubyKernelInvoker$loop_method_0_0.call(Unknown Source)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:151)
        at org.jruby.runtime.CallSite$ICBlockCallSite.call(CallSite.java:190)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1098)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:346)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:148)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:113)
        at org.jruby.runtime.Block.yield(Block.java:109)
        at org.jruby.RubyKernel.rbCatch(RubyKernel.java:793)
        at org.jruby.RubyKernelInvoker$rbCatch_method_1_0.call(Unknown Source)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:151)
        at org.jruby.runtime.CallSite$ICBlockCallSite.call(CallSite.java:190)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1098)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:346)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:627)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:294)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:175)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:151)
        at org.jruby.runtime.CallSite$ICBlockCallSite.call(CallSite.java:190)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:658)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:300)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:627)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:294)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:175)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:151)
        at org.jruby.runtime.CallSite$ICNonBlockCallSite.call(CallSite.java:172)
        at 
org.jruby.runtime.CallSite$ArgumentBoxingCallSite.call(CallSite.java:101)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:653)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:300)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:148)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:113)
        at org.jruby.runtime.Block.yield(Block.java:109)
        at org.jruby.RubyKernel.rbCatch(RubyKernel.java:793)
        at org.jruby.RubyKernelInvoker$rbCatch_method_1_0.call(Unknown Source)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:151)
        at org.jruby.runtime.CallSite$ICBlockCallSite.call(CallSite.java:190)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1098)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:346)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:627)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:294)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:175)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:151)
        at org.jruby.runtime.CallSite$ICNonBlockCallSite.call(CallSite.java:172)
        at 
org.jruby.runtime.CallSite$ArgumentBoxingCallSite.call(CallSite.java:101)
        at 
ruby.opt.work.jruby_dot_git.bin.jirb.__file__(/opt/work/jruby/bin/jirb:13)
        at ruby.opt.work.jruby_dot_git.bin.jirb.load(/opt/work/jruby/bin/jirb)
        at org.jruby.Ruby.runScript(Ruby.java:505)
        at org.jruby.Ruby.runNormally(Ruby.java:425)
        at org.jruby.Ruby.runFromMain(Ruby.java:305)
        at org.jruby.Main.run(Main.java:137)
        at org.jruby.Main.run(Main.java:93)
        at org.jruby.Main.main(Main.java:79)

This also leads to a crash during rubyspec runs of 
spec/ruby/1.8//language/constants_spec.rb

I've wrapped the spec into fails_on :jruby for now.

-- 
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