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

Wrong overloaded method selected

    XMLWordPrintableJSON

    Details

      Description

      Consider the attached example, unzip and run with:

      ./gradlew run

      A test-compilestatic.xls file will be created in your home directory. Open it with Excel, OpenOffice or LibreOffice: you'll see that the two cells have been filled with a TRUE() value.

      However, I would have expected the 'aaa' and 'bbb' strings to be put in there.

      By debugging, you'll see that the call to:

      headerCell.cellValue = header[i]

      will invoke org.apache.poi.hssf.usermodel.HSSFCell.setCellValue(boolean) instead of org.apache.poi.ss.usermodel.CellBase.setCellValue(String), which is what I would have expected, since header is a list of String values.

      Please note that the Groovy tooling for Eclipse correctly identifies that call as one to the latter method. Also, if you remove the leading @CompileStatic annotation and re-run, you'll get the correct result.

        Attachments

        1. TestGroovyGradle2.zip
          62 kB
          Mauro Molinari

          Activity

            People

            • Assignee:
              emilles Eric Milles
              Reporter:
              mauromol Mauro Molinari
            • Votes:
              0 Vote for this issue
              Watchers:
              3 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 - 0.5h
                0.5h