This is a rampaging annoyance in Groovy, and it has to do with Java's definition of "equals" in the
String class and Java code's method dispatch not going through Groovy's MOP.
~~ Robert.
Paweł Gdula wrote:
> Ok, i found:
>
> "${foo}".class => org.codehaus.groovy.runtime.GStringImpl
> foo.toString().class => java.lang.String
>
> 2009/12/16 Paweł Gdula <
[hidden email]
> <mailto:
[hidden email]>>
>
> Why result of 1 is different from 2 if both are equal in 3 (for
> grail 1.1.1 and groovy 1.6.5)
>
> def foo = 1
> (1) assert ['1','2','3'].contains("${foo}") == false
> (2) assert ['1','2','3'].contains(foo.toString()) == true
> (3) assert "${foo}" == foo.toString()
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email