[ 
https://issues.apache.org/jira/browse/GROOVY-12675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18141675#comment-18141675
 ] 

ASF GitHub Bot commented on GROOVY-12675:
-----------------------------------------

paulk-asert closed pull request #3196: GROOVY-12675: do not list private 
members of Closure as closure properties
URL: https://github.com/apache/groovy/pull/3196




> MissingPropertyException for a closure suggests the private field Closure.bcw
> -----------------------------------------------------------------------------
>
>                 Key: GROOVY-12675
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12675
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.33, 5.0.8, 5.1.3, 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> {code:groovy}
> def c = { -> 1 }
> c.metaClass.getProperty(c, 'bar')
> {code}
> *Actual:*
> {noformat}
> groovy.lang.MissingPropertyException: No such property: bar for class: 
> Script1$_run_closure1
> Possible solutions: bcw
> {noformat}
> In the same way, {{thisTyp}} suggests {{thisType}} and {{serialVersionUI}} 
> suggests {{serialVersionUID}}. {{c.metaClass.properties}} lists these and the 
> other private members of {{groovy.lang.Closure}}.
> *Expected:* no suggestion of private members of {{Closure}}. A closure class 
> does not inherit them, and the metaclass of any other {{Closure}} subclass 
> does not list them.
> Cause: {{ClosureMetaClass.getProperties}} returns the property list of the 
> metaclass of {{Closure}} itself, which includes Closure's own private fields 
> and properties. {{MethodRankHelper.getPropertySuggestionString}} ranks that 
> list for the "Possible solutions" text.
> Verified on 4.0.33, 5.0.8, 6.0.0 and master.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to