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 2023/03/02 14:46: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=17695742#comment-17695742 ] 

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

Hit again this today :(

> 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
>            Priority: Major
>         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
(v8.20.10#820010)