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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3085?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 73.6839%. 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 
([`1c5c941`](https://app.codecov.io/gh/apache/groovy/commit/1c5c941f4d2e45d5b342d09f07375fbe68fc44bc?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.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree 
graph](https://app.codecov.io/gh/apache/groovy/pull/3085/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/3085?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3085        +/-   ##
   ==================================================
   + Coverage     73.6739%   73.6839%   +0.0101%     
   - Complexity      42586      42593         +7     
   ==================================================
     Files            1678       1678                
     Lines          146911     146914         +3     
     Branches        27791      27791                
   ==================================================
   + Hits           108235     108252        +17     
   + Misses          28525      28518         -7     
   + Partials        10151      10144         -7     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3085?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...java/org/codehaus/groovy/vmplugin/v8/Selector.java](https://app.codecov.io/gh/apache/groovy/pull/3085?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.3333% <100.0000%> (+0.0938%)` | :arrow_up: |
   
   ... and [9 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3085/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: casting a GroovyObject calls getMetaClass() on the value being cast
> -------------------------------------------------------------------------
>
>                 Key: GROOVY-12557
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12557
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.33, 5.1.3, 6.0.0
>            Reporter: James Daugherty
>            Priority: Major
>
> With invokedynamic, a cast of a {{GroovyObject}} that already has the target 
> type, such as {{Widget widget = value}}, calls {{value.getMetaClass()}}: once 
> to build the call site's guard and again on each call through it. With 
> classic call sites the same cast calls nothing on the value.
> That is observable whenever {{getMetaClass()}} is not a plain field read. A 
> Spring class-based (CGLIB) proxy of a Groovy class forwards every public 
> method, {{getMetaClass()}} included, to its target. For a step-, job-, 
> request- or session-scoped bean the target exists only while the scope is 
> active, so merely assigning the proxy to a typed variable outside the scope 
> fails:
> {noformat}
> org.springframework.beans.factory.support.ScopeNotActiveException: Error 
> creating bean with name 'scopedTarget.widget': Scope 'step' is not active for 
> the current thread
>   at 
> org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35)
>   at 
> org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698)
>   at Widget$$SpringCGLIB$$0.getMetaClass
>   at org.codehaus.groovy.vmplugin.v8.Selector$MethodSelector.setGuards
>   at org.codehaus.groovy.vmplugin.v8.Selector$CastSelector.castAndSetGuards
>   at org.codehaus.groovy.vmplugin.v8.Selector$CastSelector.setCallSiteTarget
>   at org.codehaus.groovy.vmplugin.v8.IndyInterface.fallback
> {noformat}
> A Grails application moving from classic call sites to invokedynamic (the 
> Grails 9 default) meets this in code that handles scoped proxies dynamically.
> *Reproducer:* 
> https://github.com/jdaugherty/groovy-indy-cast-getmetaclass-reproducer 
> ({{./run.sh 4.0.33 5.1.3 6.0.0}}). With indy the cast {{Watched typed = 
> value}} makes 2 {{getMetaClass()}} calls on the value and fails when 
> {{getMetaClass()}} throws; with classic call sites it makes none. Reproduced 
> on 4.0.33, 5.1.3 and 6.0.0.
> *Cause:* {{Selector.CastSelector.castAndSetGuards()}} reuses 
> {{MethodSelector.setGuards(args[0])}}, which calls {{getMetaClass()}} on a 
> {{GroovyObject}} receiver to bind a {{SAME_MC}} guard. Only a cast to boolean 
> selects a method ({{asBoolean}}) through the metaclass; every other cast is 
> decided by the class of the value, which the argument guards and the class 
> SwitchPoint already cover.
> *Proposed fix:* keep the receiver metaclass guard for the {{asBoolean}} path 
> only, so a cast decided by the value's class never calls into the value, as 
> with classic call sites. A patch with tests follows as a pull request against 
> master, with backports for the 6.0.x and 5.1.x lines.



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

Reply via email to