When embedding jruby the FORCE compile option breaks constants
--------------------------------------------------------------
Key: JRUBY-5501
URL: http://jira.codehaus.org/browse/JRUBY-5501
Project: JRuby
Issue Type: Bug
Affects Versions: JRuby 1.6RC2
Environment: Tested on OSX
Reporter: Slawomir Chodnicki
Assignee: Thomas E Enebo
When embedding jRuby using the FORCE compile option an exception is thrown when
accessing constants in the compiled script. The code sample:
{code:title=ConstantCompilationTest.java|borderStyle=solid}
import junit.framework.TestCase;
import org.jruby.CompatVersion;
import org.jruby.RubyInstanceConfig.CompileMode;
import org.jruby.embed.EmbedEvalUnit;
import org.jruby.embed.LocalContextScope;
import org.jruby.embed.LocalVariableBehavior;
import org.jruby.embed.ScriptingContainer;
public class ConstantCompilationTest extends TestCase{
public void testConstantCompilation(){
ScriptingContainer c = new
ScriptingContainer(LocalContextScope.SINGLETHREAD,
LocalVariableBehavior.PERSISTENT);
c.setCompatVersion(CompatVersion.RUBY1_8);
c.setCompileMode(CompileMode.FORCE);
//c.setCompileMode(CompileMode.JIT);
EmbedEvalUnit unit = c.parse("puts RUBY_VERSION", 0);
unit.run();
}
}
{code}
When the unit is run an exception is raised:
java.lang.NullPointerException at
org.jruby.parser.StaticScope.getConstantInner(StaticScope.java:188)
The sample works when JIT is selected instead. No ruby system properties are
set when running the sample.
Cheers
Slawo
--
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