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

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

codecov-commenter commented on PR #3201:
URL: https://github.com/apache/groovy/pull/3201#issuecomment-6613136562

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3201?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :x: Patch coverage is `72.72727%` with `3 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 74.1563%. Comparing base 
([`0941dba`](https://app.codecov.io/gh/apache/groovy/commit/0941dbacf496a1667c27681c6fe76deee59bfb57?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`2acb70c`](https://app.codecov.io/gh/apache/groovy/commit/2acb70cf4edd276d9533c0dbd9e19e64c080173c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 11 commits behind head on master.
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3201?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[...aus/groovy/runtime/metaclass/ClosureMetaClass.java](https://app.codecov.io/gh/apache/groovy/pull/3201?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fruntime%2Fmetaclass%2FClosureMetaClass.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3J1bnRpbWUvbWV0YWNsYXNzL0Nsb3N1cmVNZXRhQ2xhc3MuamF2YQ==)
 | 72.7273% | [2 Missing and 1 partial :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3201?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree 
graph](https://app.codecov.io/gh/apache/groovy/pull/3201/graphs/tree.svg?width=650&height=150&src=pr&token=1r45138NfQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/groovy/pull/3201?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3201        +/-   ##
   ==================================================
   + Coverage     74.1533%   74.1563%   +0.0031%     
   - Complexity      43751      43763        +12     
   ==================================================
     Files            1692       1692                
     Lines          149516     149526        +10     
     Branches        28366      28371         +5     
   ==================================================
   + Hits           110871     110883        +12     
   + Misses          28448      28438        -10     
   - Partials        10197      10205         +8     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3201?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...aus/groovy/runtime/metaclass/ClosureMetaClass.java](https://app.codecov.io/gh/apache/groovy/pull/3201?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fruntime%2Fmetaclass%2FClosureMetaClass.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3J1bnRpbWUvbWV0YWNsYXNzL0Nsb3N1cmVNZXRhQ2xhc3MuamF2YQ==)
 | `73.6301% <72.7273%> (+1.6443%)` | :arrow_up: |
   
   ... and [14 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3201/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test 
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, 
report on failures, and find test suite problems.
   - :package: [JS Bundle 
Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save 
yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>




> A closure's metaclass reads and overwrites private fields of 
> groovy.lang.Closure
> --------------------------------------------------------------------------------
>
>                 Key: GROOVY-12680
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12680
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.33, 5.0.8, 7.0.0-alpha-1, 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> {code:groovy}
> def c = { -> 1 }
> assert c.metaClass.getProperty(c, 'bcw') == null
> assert c.metaClass.getProperty(c, 'serialVersionUID') == 4368710879820278874L
> assert c.metaClass.getMetaProperty('thisType') != null
> c.metaClass.setProperty(c, 'thisType', String)   // overwrites Closure's 
> private field
> class C {
>     private secret = 'C'
>     def read() {
>         Closure c = { -> secret }
>         c.metaClass.setProperty(c, 'thisType', Object)
>         c()
>     }
> }
> class D extends C {}
> new D().read()
> {code}
> *Actual:* getProperty returns the values of the private fields bcw, 
> serialVersionUID, thisType, mopPerturbed and PROPERTY_GETTERS of Closure, 
> also under capitalised names such as ThisType. getMetaProperty and 
> hasProperty return them. setProperty overwrites thisType and mopPerturbed. 
> After thisType is overwritten, the last line fails with "No such property: 
> secret for class: D". With the TO_SELF resolve strategy, plain {{c.thisType = 
> String}} does the same.
> *Expected:* MissingPropertyException from getProperty and setProperty, and 
> null from getMetaProperty and hasProperty, as the metaclass of any other 
> subclass gives for its superclass's private fields.
> ClosureMetaClass delegates property access to a MetaClassImpl of Closure 
> itself, which indexes Closure's own private members. A generated closure 
> class does not inherit them. Related: GROOVY-12675 (the same members in 
> getProperties).
> Verified: 5.0.8, 6.0.0 and master (including the setProperty overwrite of 
> thisType); 4.0.33 read side only (bcw and serialVersionUID).



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

Reply via email to