[
https://issues.apache.org/jira/browse/GROOVY-11799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18037233#comment-18037233
]
James Daugherty commented on GROOVY-11799:
------------------------------------------
So effectively this code:
{code:java}
def obj = new Child()
obj.metaClass.properties.findAll { Modifier.isPublic(it.modifiers)
}.collectEntries {
PropertyValue pv = new PropertyValue(obj, it)
[it.name, pv.getValue()]
} {code}
> 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)