You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Pascal Schumacher (JIRA)" <ji...@apache.org> on 2015/07/13 20:32:06 UTC
[jira] [Updated] (GROOVY-4653) Collections toString() inconsistency
[ https://issues.apache.org/jira/browse/GROOVY-4653?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pascal Schumacher updated GROOVY-4653:
--------------------------------------
Affects Version/s: 2.4.3
> Collections toString() inconsistency
> ------------------------------------
>
> Key: GROOVY-4653
> URL: https://issues.apache.org/jira/browse/GROOVY-4653
> Project: Groovy
> Issue Type: Bug
> Components: groovy-jdk
> Affects Versions: 1.7.6, 1.8-beta-3, 1.8-beta-4, 2.4.3
> Reporter: Nikita Y Volkov
>
> Here is the testcase:{code}
> class ListExtender extends ArrayList {
> ListExtender(Collection c) {
> super(c)
> }
> @Override
> String toString() {
> "Custom String"
> }
> }
> def list = new ListExtender([0, 1])
> assert "[0, 1]" == "$list"
> assert "[0, 1]" == list.asType(String)
> assert "Custom String" == list.toString()
> assert "Custom String" == (String) list
> {code}
> One would expect "Custom String" to be in every assertion. This issue also applies to HashSet. Because of this issue there's no way to fully override conversion of classes extending collections to string.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)