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

Regression: Returning List/Map created via literal as typed generic

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Information Provided
    • 3.0.11, 3.0.13, 4.0.6
    • None
    • None
    • Important

    Description

      This script 

      @groovy.transform.CompileStatic
      List<String> foo() {
          def list = [ ]
          list << "xyz"
          return list
      }

      produces

      startup failed:
      C:\Projects\Gradle\DARWin\DARWinTester\DARWin\src\TestScript.groovy: 5: [Static type checking] - Incompatible generic argument types. Cannot assign java.util.List <java.lang.Object> to: java.util.List <String>
       @ line 5, column 12.
             return list

       

      The same code worked fine in 3.0.5 and 3.0.8.

      It last worked in 3.0.10. Version 4.0.6 produces the same error.

      Attachments

        Activity

          People

            emilles Eric Milles
            eddelplus Jochen Eddelbuettel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: