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

A trait that defines a static method that uses generic return types throws "BUG! Type is null"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.6
    • 2.4.7
    • None
    • None

    Description

      If you have a trait that defines a method such as:

          static <T> T withClient(MyTrait myTrait, @DelegatesTo(MyTrait) Closure<T> callable ) {
              // no-op
          }
      

      Compilation will fail with:

      BUG! Type is null. Most probably you let a transform reuse existing ClassNodes with generics information, that is now used in a wrong context.
      

      Attachments

        1. groovy-trait-generics.zip
          22 kB
          Graeme Rocher

        Issue Links

          Activity

            People

              paulk Paul King
              graemerocher1 Graeme Rocher
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: