[
https://issues.apache.org/jira/browse/GROOVY-8708?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Brongniart Jérôme closed GROOVY-8708.
-------------------------------------
Resolution: Abandoned
> SyntaxException when extending groovy.lang.Script
> -------------------------------------------------
>
> Key: GROOVY-8708
> URL: https://issues.apache.org/jira/browse/GROOVY-8708
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 2.3.0
> Reporter: Brongniart Jérôme
> Priority: Major
>
> We are facing an issue when using the following groovy script is used as a
> ScriptBaseClass with version 2.3.0 or greater:
> {code:java}
> abstract class Templates extends Script {
> def test() {
> def a = [];
> return a;
> }
> }
> {code}
> Error:
> {noformat}
> Script1.groovy: 1: A transform used a generics containing ClassNode Templates
> for the super class Script1 directly. You are not supposed to do this. Please
> create a new ClassNode referring to the old ClassNode and use the new
> ClassNode instead of the old one. Otherwise the compiler will create wrong
> descriptors and a potential NullPointerException in TypeResolver in the
> OpenJDK. If this is not your own doing, please report this bug to the writer
> of the transform.
> {noformat}
> The error happens when calling the following example (This example is working
> as expected when using Groovy 2.2.2):
> {code:java}
> import java.io.IOException;
> import org.codehaus.groovy.control.CompilationFailedException;
> import org.codehaus.groovy.control.CompilerConfiguration;
> import groovy.lang.GroovyShell;
> import groovy.lang.Script;
> public class GroovyTest {
>
> public static void main(String[] args) throws
> CompilationFailedException, IOException {
> CompilerConfiguration groovyCompilerConfiguration = new
> CompilerConfiguration();
> groovyCompilerConfiguration.setScriptBaseClass("Templates");
> groovyCompilerConfiguration.setDebug(true);
> groovyCompilerConfiguration.setVerbose(true);
>
> GroovyShell shell = new
> GroovyShell(groovyCompilerConfiguration);
> Script script = shell.parse("print \"test\"");
> }
> }
> {code}
> Is this an issue from Groovy or is this change expected?
> Thanks and regards
--
This message was sent by Atlassian Jira
(v8.20.7#820007)