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

Incompatible covariant array return type

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.6
    • Fix Version/s: 2.4.8
    • Component/s: Compiler
    • Labels:
      None

      Description

      Probably duplicates/is related to GROOVY-7185.

      Consider the snippet:

      interface Base {}
      
      interface Derived extends Base {}
      
      interface I {
        Base[] foo()
      }
      
      interface I2 extends I {
        Derived[] foo()
      }
      
      class C implements I2 {
        Derived[] foo() { null }
      }
      

      Compilation fails with:

      The return type of Derived[] foo() in C is incompatible with Base[] in I
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                shils Shil Sinha
                Reporter:
                daniilo Daniil Ovchinnikov
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: