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

@AutoImplement is failing when covariant returns are involved

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.0.10, 4.0.1
    • Compiler
    • None

    Description

      @AutoImplement

       is failing when (Java) covariant returns are involved. 

       

      Copy the following into GroovyConsole and hit run to reproduce the error.

      import groovy.transform.*
      
      @CompileStatic
      interface Super {
          Iterable findAll()
      }
      
      @CompileStatic
      interface Sub extends Super {
          List findAll() // a List instead of an Iterable
      }
      
      @AutoImplement
      @CompileStatic
      class ThisClassFails implements Sub{} 

       

      Error will look like 

      1 compilation error:
      
      The return type of java.lang.Iterable findAll() in ThisClassFails is incompatible with java.util.List in Sub
      . At [14:1]  at line: 14, column: 1 

       

      Refs:

       

       

      Attachments

        Activity

          People

            paulk Paul King
            phaninra Phaninra
            Votes:
            0 Vote for this issue
            Watchers:
            2 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 - 20m
                20m