[
https://issues.apache.org/jira/browse/GROOVY-11840?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18054316#comment-18054316
]
Дилян Палаузов commented on GROOVY-11840:
-----------------------------------------
If this is a regression in Groovy 5, which caused no problem with Groovy 4, why
the [release notes for groovy
4.0.30|https://groovy-lang.org/changelogs/changelog-4.0.30.html] include the
change? The explanation “Regression in if statement for boolean var in groovy
5” makes no sense in release notes for Groovy 4.
> 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
> Assignee: Eric Milles
> Priority: Major
> Fix For: 3.0.26, 4.0.30, 5.0.4
>
> 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.
> {code:groovy}
> @groovy.transform.CompileStatic
> class Test {
> private static final boolean USE_SUFFIX_2 = false
> static main(String[] args) {
> ['1', '2', '3'].each { String line ->
> if( USE_SUFFIX_2 ) {
> println "Wrong 1!"
> }
> if( USE_SUFFIX_2 == true ) {
> println "Wrong 2!"
> }
> }
> }
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)