EvalUnit.run fails when container's CompileMode is FORCE and script contains 
"def" and CompileMode.FORCE
--------------------------------------------------------------------------------------------------------

                 Key: JRUBY-5036
                 URL: http://jira.codehaus.org/browse/JRUBY-5036
             Project: JRuby
          Issue Type: Bug
          Components: Embedding
    Affects Versions: JRuby 1.5.1
         Environment: Mac OS X
            Reporter: Tim Coffman
             Fix For: JRuby 1.5.1
         Attachments: JRubyTestCase.java

EvalUnit.run fails with NullPointerException when the script contains a "def" 
and the evalUnit was parsed by a ScriptingContainer with CompileMode.FORCE.

Test Case (also attached); Script 2 with CompileMode.FORCE fails with an 
exception:

public class JRubyTestCase
{

public static void main( String [] argv )
{
        test_case(org.jruby.RubyInstanceConfig.CompileMode.OFF) ;
        test_case(org.jruby.RubyInstanceConfig.CompileMode.JIT) ;
        test_case(org.jruby.RubyInstanceConfig.CompileMode.FORCE) ;
}

private static void test_case( org.jruby.RubyInstanceConfig.CompileMode 
compileMode )
{
        org.jruby.embed.ScriptingContainer container = new 
org.jruby.embed.ScriptingContainer() ;
        container.setCompileMode( compileMode ) ;
        System.out.println(String.format("compile mode = 
%1$s",compileMode.toString() ) ) ;
        org.jruby.embed.EmbedEvalUnit evalUnit1 = container.parse("puts 
\"script 1: success\"") ;
        org.jruby.embed.EmbedEvalUnit evalUnit2 = container.parse("def 
script2() ; puts \"script 2: success\"; end; script2()") ;
        evalUnit1.run() ;
        evalUnit2.run() ;
}

}


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