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

GroovyScriptEngine does not take script base class into account

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.5
    • 2.4.7
    • GroovyScriptEngine
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: