Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-6203

GroovyScriptEngine does not take script base class into account

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.5
    • Fix Version/s: 2.4.7
    • Component/s: GroovyScriptEngine
    • Labels:
      None

      Description

      When configuring GroovyScriptEngine with a custom script base class, the script engine does not take it account:

      CompilerConfiguration cc = new CompilerConfiguration();
      
      cc.setScriptBaseClass(ScriptBase.class.getName());
      
      GroovyScriptEngine engine = new GroovyScriptEngine("file://.");
      
      engine.setConfig(cc);
      
      Script script = engine.createScript("test.groovy", new Binding());
      
      assertTrue(script instanceof ScriptBase); // fails
      
      

      This has been discussed here: http://groovy.329449.n5.nabble.com/setScriptBaseClass-does-not-work-for-GroovyScriptEngine-td5710646.html
      The workaround with setting the CompilerConfiguration on the GroovyClassLoader works.
      Also related: GROOVY-3281

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pascalschumacher Pascal Schumacher
                Reporter:
                nicoulaj Julien Nicoulaud
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: