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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3086?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 `66.66667%` with `6 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 73.6720%. Comparing base 
([`0c7c1c1`](https://app.codecov.io/gh/apache/groovy/commit/0c7c1c1733871035166f5dd731903d2113876002?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`6f09672`](https://app.codecov.io/gh/apache/groovy/commit/6f096726ff71196f4da9b8970d78310b4305fd81?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 3 commits behind head on master.
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3086?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[...g/apache/groovy/runtime/indy/IndyInvalidation.java](https://app.codecov.io/gh/apache/groovy/pull/3086?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fruntime%2Findy%2FIndyInvalidation.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9ydW50aW1lL2luZHkvSW5keUludmFsaWRhdGlvbi5qYXZh)
 | 50.0000% | [1 Missing and 2 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3086?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   | 
[...java/org/codehaus/groovy/vmplugin/v8/Selector.java](https://app.codecov.io/gh/apache/groovy/pull/3086?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fvmplugin%2Fv8%2FSelector.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3ZtcGx1Z2luL3Y4L1NlbGVjdG9yLmphdmE=)
 | 66.6667% | [0 Missing and 2 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3086?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   | 
[...odehaus/groovy/vmplugin/v8/IndyCompoundAssign.java](https://app.codecov.io/gh/apache/groovy/pull/3086?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fvmplugin%2Fv8%2FIndyCompoundAssign.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3ZtcGx1Z2luL3Y4L0luZHlDb21wb3VuZEFzc2lnbi5qYXZh)
 | 83.3333% | [0 Missing and 1 partial :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3086?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/3086/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/3086?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3086        +/-   ##
   ==================================================
   - Coverage     73.6739%   73.6720%   -0.0019%     
   - Complexity      42586      42589         +3     
   ==================================================
     Files            1678       1678                
     Lines          146911     146927        +16     
     Branches        27791      27797         +6     
   ==================================================
   + Hits           108235     108244         +9     
   - Misses          28525      28528         +3     
   - Partials        10151      10155         +4     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3086?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...odehaus/groovy/vmplugin/v8/IndyCompoundAssign.java](https://app.codecov.io/gh/apache/groovy/pull/3086?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fvmplugin%2Fv8%2FIndyCompoundAssign.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3ZtcGx1Z2luL3Y4L0luZHlDb21wb3VuZEFzc2lnbi5qYXZh)
 | `81.8182% <83.3333%> (-0.1818%)` | :arrow_down: |
   | 
[...java/org/codehaus/groovy/vmplugin/v8/Selector.java](https://app.codecov.io/gh/apache/groovy/pull/3086?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fvmplugin%2Fv8%2FSelector.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3ZtcGx1Z2luL3Y4L1NlbGVjdG9yLmphdmE=)
 | `81.0631% <66.6667%> (-0.1764%)` | :arrow_down: |
   | 
[...g/apache/groovy/runtime/indy/IndyInvalidation.java](https://app.codecov.io/gh/apache/groovy/pull/3086?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fruntime%2Findy%2FIndyInvalidation.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9ydW50aW1lL2luZHkvSW5keUludmFsaWRhdGlvbi5qYXZh)
 | `78.6325% <50.0000%> (-1.5477%)` | :arrow_down: |
   
   ... and [9 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3086/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>




> Indy: call site keeps a method replaced on a metaclass the receiver shares 
> with another class
> ---------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12558
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12558
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 6.0.0
>            Reporter: James Daugherty
>            Priority: Major
>
> On Groovy 6 with invokedynamic, a call site whose receiver uses the metaclass 
> of another class keeps invoking a method after that metaclass replaces it. 
> Groovy 5, and Groovy 6 with classic call sites, invoke the replacement. This 
> is a regression from GROOVY-12191 (6.0.0-beta-1).
> Such receivers are common in tests: Spock's {{Mock()}} generates a subclass 
> of the mocked type whose {{getMetaClass()}} answers the mocked type's 
> metaclass, so a feature that replaces a method on the mock's metaclass 
> changes the {{ExpandoMetaClass}} of the mocked type, and many proxy libraries 
> behave the same way. A specification that replaces such a method in one 
> feature and runs the same code under test in a later feature gets the earlier 
> feature's closure: a {{0 * collaborator.update(*_)}} interaction fails with 
> "Too many invocations", or an expected exception is never thrown.
> *Reproducer:* 
> https://github.com/jdaugherty/groovy-indy-shared-metaclass-switchpoint-reproducer
>  ({{./run.sh 5.1.3 6.0.0}}). {{GreeterProxy extends Greeter}} and is given 
> the {{ExpandoMetaClass}} of {{Greeter}}, as a mock or proxy subclass is. One 
> call site invokes {{greet()}} and one {{+=}} site invokes {{plus()}}; each 
> method is replaced on the metaclass between two calls of the same site:
> {noformat}
> == Groovy 5.1.3
>    indy=true: method call after replacing the method:   second (OK)
>    indy=true: compound assignment after replacing plus: second (OK)
> == Groovy 6.0.0
>    indy=true: method call after replacing the method:   first (STALE: the 
> call site still invokes the replaced method)
>    indy=true: compound assignment after replacing plus: first (STALE: the 
> call site still invokes the replaced method)
>    indy=false: method call after replacing the method:   second (OK)
>    indy=false: compound assignment after replacing plus: second (OK)
> {noformat}
> *Cause:* GROOVY-12191 replaced the global indy SwitchPoint with per-class 
> domains. A call site is guarded by the SwitchPoint of the receiver's class 
> ({{Selector.MethodSelector.captureTokenAndGetMetaClass()}}, 
> {{IndyInvalidation.classSwitchPointFor(args[0])}}; likewise in 
> {{IndyCompoundAssign.resolve}}). A change to a metaclass retires the domain 
> of the class the metaclass belongs to, {{MetaClass.getTheClass()}} 
> ({{IndyInvalidation.switchPointForMetaClass}} / {{invalidateMetaClass}}). 
> When the receiver's class is not the metaclass's class, as for 
> {{GreeterProxy}} and the {{Greeter}} metaclass it uses, the change retires 
> {{Greeter}}'s domain while the site waits on {{GreeterProxy}}'s. The receiver 
> metaclass guard ({{SAME_MC}}) does not catch it either, because replacing an 
> {{ExpandoMetaClass}} method keeps the same metaclass instance.
> *Proposed fix:* when the selected metaclass belongs to a class other than the 
> receiver's, also capture that class's SwitchPoint before selection and guard 
> the site with both. That applies to {{Selector}} and to 
> {{IndyCompoundAssign}}, which captures its token the same way. A patch with 
> tests follows as a pull request against master, with a backport for the 6.0.x 
> line.



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

Reply via email to