Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-6864

Stub generation doesn't generate constructors added by @TupleConstructor

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.3.2
    • None
    • None

    Description

      When doing joint compilation, the generated subs don't include the constructors created by the @TupleConstructor.

      I created a groovy class:

      @TupleConstructor
      class SomeGroovyClass {
          String someValue
      }
      

      ... and a java class:

      public class Client {
          public static void main(String [] args)
          {
              SomeGroovyClass groovyClass = new SomeGroovyClass("val");
      
          }
      }
      

      When I build this in maven using the gmavenplus plugin I get the following output:

      [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;
      

      Looking at the generated stub shows that the constructor is not added:

      @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) { }
      }
      

      You can find a sample project using maven in attachment.

      Attachments

        1. jointCompilationTest.zip
          3 kB
          Jan Bols

        Issue Links

          Activity

            People

              Unassigned Unassigned
              janbols Jan Bols
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: