groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul King (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (GROOVY-8287) Casting a Matcher to Boolean changes behaviour between 2.3.7 and 2.4.12 (or maybe it's the precedence of a cast changing?)
Date Mon, 14 Aug 2017 09:57:00 GMT

     [ https://issues.apache.org/jira/browse/GROOVY-8287?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Paul King closed GROOVY-8287.
-----------------------------
    Resolution: Not A Bug

> Casting a Matcher to Boolean changes behaviour between 2.3.7 and 2.4.12 (or maybe it's
the precedence of a cast changing?)
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-8287
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8287
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Matt Sheppard
>
> Ran across some old code which was failing after a groovy version upgrade, and boiled
it down to this difference.
> {noformat}
> $ tools/groovy/bin/groovy -v
> Groovy Version: 2.3.7 JVM: 1.8.0_25 Vendor: Oracle Corporation OS: Linux
> $ tools/groovy/bin/groovy -e "def result = ((Boolean) 'are you a foolish fool?' =~ 'fool');
if (result) {println 'true'} else {println 'false'}"
> true
> {noformat}
> vs
> {noformat}
> $ tools/groovy/bin/groovy -v
> Groovy Version: 2.4.12 JVM: 1.8.0_141 Vendor: Oracle Corporation OS: Linux
> $ tools/groovy/bin/groovy -e "def result = ((Boolean) 'are you a foolish fool?' =~ 'fool');
if (result) {println 'true'} else {println 'false'}"
> false
> {noformat}
> Basically, the result of casting the Matcher returned by the '=~' operator to a Boolean
used to give me what seems to be the result of calling 'find()' on the matcher, where as the
new version seems to always return false.
> Is that change in behaviour between versions expected, or is it a bug?
> Nothing on http://groovy-lang.org/changelogs/changelog-2.4.0.html jumped out at me as
related.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message