You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2020/11/11 02:02:05 UTC
[jira] [Closed] (GROOVY-9469) Original exception during global AST
transformation no longer preserved in error message
[ https://issues.apache.org/jira/browse/GROOVY-9469?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-9469.
-----------------------------
> Original exception during global AST transformation no longer preserved in error message
> ----------------------------------------------------------------------------------------
>
> Key: GROOVY-9469
> URL: https://issues.apache.org/jira/browse/GROOVY-9469
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 3.0.0, 3.0.2
> Reporter: Marcin Zajaczkowski
> Assignee: Paul King
> Priority: Minor
> Fix For: 4.0.0-alpha-1, 3.0.3, 2.5.11
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> Global AST transformation in Spock throws exception with meaningful error message if used with incompatible Groovy version (e.g. Spock for Groovy 2.5 executed with Groovy 2.4):
> {code:java}
> Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at
> jar:file:/.../spock-core-1.3-groovy-2.5.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation
> because of exception org.spockframework.util.IncompatibleGroovyVersionException:
> The Spock compiler plugin cannot execute because Spock 1.3.0-groovy-2.5 is not compatible
> with Groovy 2.4.3. For more information, see http://versioninfo.spockframework.org
> Spock artifact: file:/.../spock-core-1.3-groovy-2.5.jar
> Groovy artifact: file:/.../groovy-2.4.3.jar
> {code}
> However, it stopped working with Spock 2.0 for Groovy 2.5 and Groovy 3.0:
> {code:java}
> Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at
> jar:file:/.../spock-core-2.0-M1-groovy-2.5.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation
> because of exception java.lang.reflect.InvocationTargetException
> {code}
> It's not very constructive for people seeing that error message. Firstly, I suspected some incompatibilities in the Spock code which completely fails with new Groovy. However, it turned out that the exception is hidden by Groovy itself.
> I slightly modified ASTTransformationVisitor it detect that situation and get target/cause in a case of InvocationTargetException - my [PR|https://github.com/apache/groovy/pull/1193].
> It helped, however, I haven't found any change in the ASTTransformationVisitor which could cause that regression. It might to some 2.5→3.0 change how constructor are called (e.g. around CachedConstructor which is used, but doesn't seem to intercept the exception) or anything else. You might want to investigate it - it worked without my tweak in Groovy 2.5.
> Related Spock issues: [https://github.com/spockframework/spock/issues/1067]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)