You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Matt Sheppard (JIRA)" <ji...@apache.org> on 2017/08/14 06:59:00 UTC
[jira] [Created] (GROOVY-8287) Casting a Matcher to Boolean changes
behaviour between 2.3.7 and 2.4.12
Matt Sheppard created GROOVY-8287:
-------------------------------------
Summary: Casting a Matcher to Boolean changes behaviour between 2.3.7 and 2.4.12
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)