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 2025/11/10 18:26:00 UTC
[jira] [Commented] (GROOVY-11799) getMetaPropertyValues & getProperties are returning private fields
[ https://issues.apache.org/jira/browse/GROOVY-11799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18037230#comment-18037230 ]
Eric Milles commented on GROOVY-11799:
--------------------------------------
Instead of "object.getProperties()" or "object.getMetaPropertyValues()", is it possible for you to make use of "object.getMetaClass().getProperties()"? This will give you access to the modifiers and let you filter as you see fit.
> getMetaPropertyValues & getProperties are returning private fields
> ------------------------------------------------------------------
>
> Key: GROOVY-11799
> URL: https://issues.apache.org/jira/browse/GROOVY-11799
> Project: Groovy
> Issue Type: Task
> Components: Compiler
> Affects Versions: 4.0.29
> Reporter: James Daugherty
> Priority: Critical
>
> I'm upgrading a Grails application from Groovy 3 to Groovy 4. As part of the upgrade, I've noticed private fields are showing up in the property list - which was not the behavior in Groovy 3.
> Given this groovy console script:
>
> {code:java}
> trait Parent {
> private boolean shouldNotSee = true
> }
> class Child implements Parent {
> private boolean childBoolean = true
> String other = "Hello"
> }
>
> new Child().properties{code}
> The output for Groovy 3 is:
>
>
> {code:java}
> Result: [other:Hello, class:class Child] {code}
> While the output for Groovy 4 is:
>
>
> {code:java}
> [childBoolean:true, other:Hello, Parent__shouldNotSee:true, class:class Child] {code}
> It seems this was already fixed in Groovy 5 under https://issues.apache.org/jira/browse/GROOVY-10438. This may have been previously reported as https://issues.apache.org/jira/browse/GROOVY-10555 but it doesn't look like it was fixed.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)