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

Traits using generics generate incorrect stub for Properties

    XMLWordPrintableJSON

Details

    Description

      trait Test<V> {
          V value
      }
      
      class TestImpl implements Test<String> { }
      

      Generates a stub like this

      import java.lang.*;
      import java.io.*;
      import java.net.*;
      import java.util.*;
      import groovy.lang.*;
      import groovy.util.*;
      
      public class TestImpl
        extends java.lang.Object  implements
          Test<java.lang.String>,    groovy.lang.GroovyObject {
      ;
      @groovy.transform.Generated() @groovy.transform.Internal() public  groovy.lang.MetaClass getMetaClass() { return (groovy.lang.MetaClass)null;}
      @groovy.transform.Generated() @groovy.transform.Internal() public  void setMetaClass(groovy.lang.MetaClass mc) { }
      @groovy.transform.Generated() @groovy.transform.Internal() public  java.lang.Object invokeMethod(java.lang.String method, java.lang.Object arguments) { return null;}
      @groovy.transform.Generated() @groovy.transform.Internal() public  java.lang.Object getProperty(java.lang.String property) { return null;}
      @groovy.transform.Generated() @groovy.transform.Internal() public  void setProperty(java.lang.String property, java.lang.Object value) { }
      public  V getValue() { return null;}
      public  void setValue(V value) { }
      }
      

      Note that value has type V instead of type String and the generic reference isn't declared in the class either.

      Attachments

        Issue Links

          Activity

            People

              daniel_sun Daniel Sun
              keegan Keegan Witt
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h