"A = 12; class A::B; end"  crashes JRuby
----------------------------------------

                 Key: JRUBY-2358
                 URL: http://jira.codehaus.org/browse/JRUBY-2358
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1
         Environment: Latest JRuby 1.1
            Reporter: Vladimir Sizikov
             Fix For: JRuby 1.1.1


This issue is inspired by:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/16118

{noformat}
# JRuby 1.0.x
#>jruby -e 'A = 12; class A::B; end'
Exception in thread "main" java.lang.ClassCastException: org.jruby.RubyFixnum 
cannot be cast to org.jruby.RubyModule
        at 
org.jruby.evaluator.EvaluationState.getEnclosingModule(EvaluationState.java:2168)
        at 
org.jruby.evaluator.EvaluationState.classNode(EvaluationState.java:685)
        at 
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:211)
        at 
org.jruby.evaluator.EvaluationState.blockNode(EvaluationState.java:533)
        at 
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:201)
        at 
org.jruby.evaluator.EvaluationState.rootNode(EvaluationState.java:1628)
        at 
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:356)
        at org.jruby.evaluator.EvaluationState.eval(EvaluationState.java:164)
        at org.jruby.Ruby.eval(Ruby.java:278)
        at org.jruby.Ruby.compileOrFallbackAndRun(Ruby.java:306)
        at org.jruby.Main.runInterpreter(Main.java:238)
        at org.jruby.Main.runInterpreter(Main.java:183)
        at org.jruby.Main.run(Main.java:120)
        at org.jruby.Main.main(Main.java:95)

# JRuby 1.1
#>jruby -e 'A = 12; class A::B; end'
Exception in thread "main" java.lang.ClassCastException: org.jruby.RubyFixnum 
cannot be cast to org.jruby.RubyModule
        at 
org.jruby.javasupport.util.RuntimeHelpers.prepareClassNamespace(RuntimeHelpers.java:383)
        at __dash_e__.rubyclass__B__0(-e)
        at __dash_e__.__file__(-e:1)
        at __dash_e__.load(-e)
        at org.jruby.Ruby.runScript(Ruby.java:511)
        at org.jruby.Ruby.runNormally(Ruby.java:431)
        at org.jruby.Ruby.runFromMain(Ruby.java:311)
        at org.jruby.Main.run(Main.java:141)
        at org.jruby.Main.run(Main.java:88)
        at org.jruby.Main.main(Main.java:79)
{noformat}

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