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 2026/03/18 22:16:00 UTC
[jira] [Resolved] (GROOVY-11875) Inner classes property vs field access
[ https://issues.apache.org/jira/browse/GROOVY-11875?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles resolved GROOVY-11875.
----------------------------------
Fix Version/s: 5.0.5
Resolution: Fixed
https://github.com/apache/groovy/commit/cbb026565896315685c458685a6a0f7e673073fb
> Inner classes property vs field access
> --------------------------------------
>
> Key: GROOVY-11875
> URL: https://issues.apache.org/jira/browse/GROOVY-11875
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 5.0.4
> Reporter: Gregory Moltchadski
> Assignee: Eric Milles
> Priority: Major
> Fix For: 5.0.5
>
> Attachments: MRE.groovy
>
>
> The attached valid piece of code works fine on Groovy 4, but fails on Groovy 5 with the following exception:
> Cannot cast object 'false' with class 'java.lang.Boolean' to class 'java.util.concurrent.atomic.AtomicBoolean'
> It looks like the inner class tries to access the property via the underlying field instead of the getter.
> {code:groovy}
> import java.util.concurrent.atomic.AtomicBoolean
> class Test
> {
> private AtomicBoolean test = new AtomicBoolean()
> boolean isTest() { test.get() }
> void bar() { new Inner().bar() }
> class Inner
> {
> void bar() { println test }
> }
> }
> Test test = new Test()
> test.bar()
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)