You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2026/01/14 02:24:00 UTC
[jira] [Commented] (GROOVY-11840) Regression in if statement for boolean var in groovy 5
[ https://issues.apache.org/jira/browse/GROOVY-11840?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18051682#comment-18051682 ]
Paul King commented on GROOVY-11840:
------------------------------------
Wow! I presume we have a non-null reference being tested by Groovy truth.
Workarounds are to remove @CompileStatic or use a for loop "for (line in ['1', '2', '3']) { ...".
> Regression in if statement for boolean var in groovy 5
> ------------------------------------------------------
>
> Key: GROOVY-11840
> URL: https://issues.apache.org/jira/browse/GROOVY-11840
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 5.0.3
> Reporter: Andriy Rysin
> Priority: Major
> Attachments: Test.groovy
>
>
> In groovy 5 "if( booleanVar )" evaluates to true even if boolean is false.
> See test example. On groovy4 both if statements are false, on groovy5 the first one is true.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)