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

Incompatible covariant array return type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.6
    • 2.4.8
    • Compiler
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: