[ 
https://issues.apache.org/jira/browse/GROOVY-9469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17070252#comment-17070252
 ] 

Paul King commented on GROOVY-9469:
-----------------------------------

This works up until 2.5.7 but starts failing from 2.5.8.

> 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
>            Priority: Minor
>          Time Spent: 0.5h
>  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)

Reply via email to