Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0, 1.1-rc-3
    • Fix Version/s: 1.6-rc-1, 1.6-rc-2, 1.7.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      N/A

      Description

      Now that Java 6 released, there's a lot of interest going around about the new JSR 223 scripting platform. Unfortunately, neither Java SE 6 nor the current Groovy builds support JSR 223-style Groovy out of the box.

      Fortunately, adding this to Groovy is trivial. The code is both simple and available from the JSR 223 reference implementation (https://scripting.dev.java.net/). The license permits redistributing as source or binary as long as mention that some code comes from Sun and release them from liability.

      Ideally, the Groovy project should integrate the three implementation classes and the service declaration into groovy-1.0.jar. If you do this, simply dropping Groovy into your classpath is enough to enable the Groovy engine. At the very least, we should bundle the RI's groovy-engine.jar into the groovy binary distribution. Finding and installing the Sun RI is a bit of a pain and will discourage would-be users.

      Behind the scenes, scripting engines get enabled by adding a file to the META-INF/services directory of a JAR as specified in the new Java 6 java.util.ServiceLoader (http://java.sun.com/javase/6/docs/api/java/util/ServiceLoader.html). This file just tells the JVM that it can find a service implementation in a specific class. For JSR 223, the implementation is just a concrete ScriptEngineFactory and a couple of support classes:

      https://scripting.dev.java.net/source/browse/scripting/engines/groovy/src/META-INF/services/javax.script.ScriptEngineFactory?rev=1.1.1.1&view=auto&content-type=text/vnd.viewcvs-markup

      https://scripting.dev.java.net/source/browse/scripting/engines/groovy/src/com/sun/script/groovy/GroovyScriptEngineFactory.java?rev=1.4&view=auto&content-type=text/vnd.viewcvs-markup

      https://scripting.dev.java.net/source/browse/scripting/engines/groovy/src/com/sun/script/groovy/GroovyCompiledScript.java?rev=1.1.1.1&view=auto&content-type=text/vnd.viewcvs-markup

      https://scripting.dev.java.net/source/browse/scripting/engines/groovy/src/com/sun/script/groovy/GroovyScriptEngine.java?rev=1.4&view=auto&content-type=text/vnd.viewcvs-markup

      I'm happy to volunteer any assistance that might help make this part of the Groovy distribution. However, adding these classes and the service definition to groovy-1.0.jar should be trivial and will provide a great service (pun intended).

      1. jsr223-patch-1.txt
        30 kB
        James P. White

        Activity

        Sarah Gerweck created issue -
        Guillaume Delcroix made changes -
        Field Original Value New Value
        Assignee Guillaume Laforge [ guillaume ]
        Paul King made changes -
        Summary Bundle JSR 223 Support in Groovy 1.0 Bundle JSR 223 Support in Groovy
        Affects Version/s 1.1-rc-3 [ 13166 ]
        Jochen Theodorou made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Won't Fix [ 2 ]
        James P. White made changes -
        Status Closed [ 6 ] Reopened [ 4 ]
        Assignee Jim White [ jimwhite ]
        Resolution Won't Fix [ 2 ]
        James P. White made changes -
        Status Reopened [ 4 ] In Progress [ 3 ]
        James P. White made changes -
        Attachment jsr223-patch.txt [ 38120 ]
        James P. White made changes -
        Attachment jsr223-patch-1.txt [ 38121 ]
        James P. White made changes -
        Attachment jsr223-patch.txt [ 38120 ]
        James P. White made changes -
        Fix Version/s 1.6 [ 13832 ]
        Fix Version/s 1.7 [ 14665 ]
        James P. White made changes -
        Resolution Fixed [ 1 ]
        Status In Progress [ 3 ] Resolved [ 5 ]
        James P. White made changes -
        Fix Version/s 1.6-rc-1 [ 14009 ]
        Paul King made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Mark Thomas made changes -
        Workflow jira [ 12730724 ] Default workflow, editable Closed status [ 12742692 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12972382 ] Default workflow, editable Closed status [ 12980232 ]

          People

          • Assignee:
            James P. White
            Reporter:
            Sarah Gerweck
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development