[jira] [Commented] (GROOVY-7764) Joint compilation does not work with AST-transformed Groovy

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] [Commented] (GROOVY-7764) Joint compilation does not work with AST-transformed Groovy

JIRA jira@apache.org

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

Eric Milles commented on GROOVY-7764:

I know this issue is old, but this is one of the biggest cross-compatibility issues for us.  We really like all the new stuff that Groovy offers and we want to mix it into our Java project where appropriate.  However, we have has to restrain ourselves from using @Delegate, @Immutable, @Builder, @Sortable, @TupleConstructor, @InheritConstructors and several others that add methods or interfaces implemented.  We have to hold back only because joint compilation of Java and Groovy fails to account for these additions in the generated stubs.

The end goal is to be able to read the Groovy documentation, find an interesting transform like @Delegate or @Sortable, and apply it to a pojo to make a much simpler pogo that lives in the same package (and source folder) as before.  Having to move converted Java classes to another source folder or project so that AST transforms works as described is a non-starter for us.

> Joint compilation does not work with AST-transformed Groovy
> -----------------------------------------------------------
>                 Key: GROOVY-7764
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7764
>             Project: Groovy
>          Issue Type: Bug
>          Components: Stub generator / Joint compiler
>    Affects Versions: 2.4.6
>            Reporter: O. Rei├čig
>         Attachments: foo.zip
> When using AST transformations together with joint compilation the generated stubs don't mind the transformations, which may yield invalid classes, that javac will fail to compile.
> Example:
> {code}
> [...]
> class GroovyTest implements Callable {
>     @Delegate
>     private final Callable c = { println "Hello World" }
> }
> {code}
> will get compiled into the following stub:
> {code}
> [...]
> public class GroovyTest
>   extends java.lang.Object  implements
>     java.util.concurrent.Callable,    groovy.lang.GroovyObject {
> ;
> public  groovy.lang.MetaClass getMetaClass() { return (groovy.lang.MetaClass)null;}
> public  void setMetaClass(groovy.lang.MetaClass mc) { }
> public  java.lang.Object invokeMethod(java.lang.String method, java.lang.Object arguments) { return null;}
> public  java.lang.Object getProperty(java.lang.String property) { return null;}
> public  void setProperty(java.lang.String property, java.lang.Object value) { }
> }
> {code}
> which claims to implement {{Callable}}, but lacks a {{call}} method.
> I don't know if this is specific to {{@Delegate}}, but noticed similar behaviour with {{@InheritConstructors}}.

This message was sent by Atlassian JIRA