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

Traits using generics generate incorrect stub for Methods

    XMLWordPrintableJSON

Details

    Description

      trait SomeGroovyTrait<D> {
          List<D> list(D arg) {
              [arg]
          }
      }
      
      class SomeGroovyClass implements SomeGroovyTrait<String> { }
      

      Generates a stub like this

      ...
      public class SomeGroovyClass implements SomeGroovyTrait<java.lang.String>, groovy.lang.GroovyObject {
          ...
          public  java.util.List<D> list(D arg) { return (java.util.List<D>)null;}    // <== D should be String
      }
      

      Note that the return type and parameter types use D instead of type String and the generic reference isn't declared in the class either.

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              keegan Keegan Witt
              Votes:
              0 Vote for this issue
              Watchers:
              1 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