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

Jochen Theodorou commented on GROOVY-6864:
------------------------------------------

To solve this you require a compiler that can compile the Groovy classes 
independent of the Java class compilation. That requires reading representing 
the Java sources as AST elements. I think that is at least a man-week (maybe a 
month even) of somebody that knows what he is doing. What is missing, is 
getting that time in a big enough chunk to allow for this implementation for 
most people.

> 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)

Reply via email to