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

Incompatible covariant array return type

Agile BoardAttach filesAttach ScreenshotVotersStop watchingWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    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

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment