[groovy-dev] get scripting engine by file extension

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[groovy-dev] get scripting engine by file extension

arhan
Hello!

I have an application where I use JSR-223 for evaluating the scripts, and I use file extension for identifying the scripting engine that is required to evaluate the script:

ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
ScriptEngine engine = scriptEngineManager.getEngineByExtension("groovy");

With groovy-1.0 it works fine.
but with groovy-1.1-beta2 this code throws a following exception:

Exception in thread "main" java.lang.IncompatibleClassChangeError: Found interface groovy.lang.MetaClass, but class was expected
    at com.sun.script.groovy.GroovyScriptEngine.<clinit>(GroovyScriptEngine.java:63)
    at com.sun.script.groovy.GroovyScriptEngineFactory.getScriptEngine (GroovyScriptEngineFactory.java:87)
    at javax.script.ScriptEngineManager.getEngineByExtension(ScriptEngineManager.java:275)
    at <user code stack trace follows>


And in the version 1.0 there really was "public abstract class MetaClass" which is now "public interface MetaClass extends MetaObjectProtocol"

So the question is:  is the groovy API not following JSR or the JSR engine implementations is outdated ? :)
Can anyone suggest?

Thx,
--
Anton Arhipov