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

Unexpected error when trait used as a generic type bound

    XMLWordPrintableJSON

Details

    • Question
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.5
    • 2.5.14, 3.0.6
    • Groovy Console
    • groovy 3.0.5 + jdk1.8

    Description

      code example :

      trait Data {}
      
      class TestData implements Data {}
      
      class AbstractData<D extends Data>{ D data }
      
      def test = new AbstractData<TestData>()
      

       

      when i compile groovy,it compile failed:

      1 compilation error:
      
      The type TestData is not a valid substitute for the bounded parameter <D extends Data>
       at line: 7, column: 29
      

       

      Is this the wrong way to write it?

       

       

      Attachments

        Activity

          People

            emilles Eric Milles
            hdfg159 hdfg159
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: