[jira] [Commented] (GROOVY-9893) Wrong overloaded method selected

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (GROOVY-9893) Wrong overloaded method selected

Eric Milles (Jira)

    [ https://issues.apache.org/jira/browse/GROOVY-9893?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17262694#comment-17262694 ]

Mauro Molinari commented on GROOVY-9893:
----------------------------------------

Please note that another way to obtain the correct result, even with {{@CompileStatic}}, is to explicitly call the setter method:

{{headerCell.setCellValue(header[i])}}

instead of using the property-style access.

> Wrong overloaded method selected
> --------------------------------
>
>                 Key: GROOVY-9893
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9893
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.5.14
>            Reporter: Mauro Molinari
>            Priority: Major
>         Attachments: TestGroovyGradle2.zip
>
>
> 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)