You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/06/10 16:34:00 UTC
[jira] [Resolved] (GROOVY-10655) Add extension method for coercing AtomicBoolean to boolean value
[ https://issues.apache.org/jira/browse/GROOVY-10655?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles resolved GROOVY-10655.
----------------------------------
Fix Version/s: 5.0.0-alpha-1
Resolution: Fixed
https://github.com/apache/groovy/commit/9af91fa19067d4c12eb0b722264d9d1ed9ba2f4e
> Add extension method for coercing AtomicBoolean to boolean value
> ----------------------------------------------------------------
>
> Key: GROOVY-10655
> URL: https://issues.apache.org/jira/browse/GROOVY-10655
> Project: Groovy
> Issue Type: Improvement
> Components: groovy-jdk
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Minor
> Fix For: 5.0.0-alpha-1
>
>
> {{AtomicInteger}} and the other number atomics extend {{Number}} and so they support conversion to {{boolean}} through extension method {{asBoolean(Number)}}. However, {{AtomicBoolean}} requires a separate extension method for this.
> {code:groovy}
> // you can omit ".asBoolean()"
> assert new AtomicBoolean(true).asBoolean()
> assert !new AtomicBoolean(false).asBoolean()
> assert !new AtomicBoolean(true).tap{set(false)}
> {code}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)