You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Mauro Molinari (JIRA)" <ji...@apache.org> on 2018/01/11 10:33:00 UTC

[jira] [Commented] (GROOVY-6864) Stub generation doesn't generate constructors added by @TupleConstructor

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

Mauro Molinari commented on GROOVY-6864:
----------------------------------------

Is there any progress on this?
I just came across this issue with Gradle, in a mixed Groovy/Java project. If I have to split the codebase putting all the Groovy code in a separate project (hoping it does not depend on Java code, which is really hard in my case) would substantially break the strong point of having Groovy and Java seamlessly integrate with each other.
Otherwise I must give up on using {{@Tupleconstructor}} and alike, which is a real pity... :(

> Stub generation doesn't generate constructors added by @TupleConstructor
> ------------------------------------------------------------------------
>
>                 Key: GROOVY-6864
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6864
>             Project: Groovy
>          Issue Type: Bug
>          Components: Stub generator / Joint compiler
>    Affects Versions: 2.3.2
>            Reporter: Jan Bols
>         Attachments: jointCompilationTest.zip
>
>
> When doing joint compilation, the generated subs don't include the constructors created by the {{@TupleConstructor}}.
> I created a groovy class:
> {code}
> @TupleConstructor
> class SomeGroovyClass {
>     String someValue
> }
> {code}
> ... and a java class:
> {code}
> public class Client {
>     public static void main(String [] args)
>     {
>         SomeGroovyClass groovyClass = new SomeGroovyClass("val");
>     }
> }
> {code}
> When I build this in maven using the gmavenplus plugin I get the following output:
> {code}
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project jointCompilationTest: Compilation failure
> [ERROR] C:\dev\projects\jointCompilationTest\src\main\java\Client.java:[21,38] error: constructor SomeGroovyClass in class SomeGroovyClass cannot be applied to given types;
> {code}
> Looking at the generated stub shows that the constructor is not added:
> {code}
> @groovy.transform.TupleConstructor() public class SomeGroovyClass
>   extends java.lang.Object  implements
>     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) { }
> public  java.lang.String getSomeValue() { return (java.lang.String)null;}
> public  void setSomeValue(java.lang.String value) { }
> }
> {code}
> You can find a sample project using maven in attachment.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)