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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2635?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 `70.00000%` with `3 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 68.5392%. Comparing base 
([`49e6912`](https://app.codecov.io/gh/apache/groovy/commit/49e691225579155de4f7fe9c2cc7a2e7dc0d1429?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`9645a1c`](https://app.codecov.io/gh/apache/groovy/commit/9645a1c0aa20cdc027eba971acfe255c85eee707?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 1 commits behind head on master.
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2635?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[...oovy/transform/stc/TraitTypeCheckingExtension.java](https://app.codecov.io/gh/apache/groovy/pull/2635?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2Fstc%2FTraitTypeCheckingExtension.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9zdGMvVHJhaXRUeXBlQ2hlY2tpbmdFeHRlbnNpb24uamF2YQ==)
 | 70.0000% | [0 Missing and 3 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2635?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/2635/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/2635?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #2635        +/-   ##
   ==================================================
   + Coverage     68.5346%   68.5392%   +0.0046%     
   - Complexity      33709      33711         +2     
   ==================================================
     Files            1523       1523                
     Lines          127861     127867         +6     
     Branches        23231      23235         +4     
   ==================================================
   + Hits            87629      87639        +10     
   + Misses          32465      32458         -7     
   - Partials         7767       7770         +3     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2635?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...oovy/transform/stc/TraitTypeCheckingExtension.java](https://app.codecov.io/gh/apache/groovy/pull/2635?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2Fstc%2FTraitTypeCheckingExtension.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9zdGMvVHJhaXRUeXBlQ2hlY2tpbmdFeHRlbnNpb24uamF2YQ==)
 | `84.2105% <70.0000%> (-2.0640%)` | :arrow_down: |
   
   ... and [5 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/2635/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>




> STC cannot resolve inherited static trait method from sub-trait body
> --------------------------------------------------------------------
>
>                 Key: GROOVY-12106
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12106
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 5.0.7
>            Reporter: James Fredley
>            Assignee: Paul King
>            Priority: Major
>              Labels: static-method, sts, traits
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> h2. Summary
> Groovy 5 static type checking does not resolve a static method declared by a 
> parent trait when the method is called from a sub-trait body.
> This is independent of Grails and can be reproduced with plain Groovy traits 
> under @CompileStatic.
> This was re-tested on Groovy 5.0.7-SNAPSHOT. Both an unqualified call and a 
> qualified call fail static type checking:
> {code:groovy}
> inheritedStaticMethod(value)
> {code}
> {code:groovy}
> ParentTrait.inheritedStaticMethod(value)
> {code}
> The failure is distinct from GROOVY-11985, which fixed 
> static-override-via-this. This issue is about resolving a parent trait's 
> static method from a sub-trait body.
> h2. Standalone reproducer
> {code:groovy}
> import groovy.transform.CompileStatic
> @CompileStatic
> trait ParentTrait {
>     static void configure(Closure closure, Object target) {
>         if (closure != null) {
>             closure.delegate = target
>             closure.resolveStrategy = Closure.DELEGATE_ONLY
>             closure.call()
>         }
>     }
> }
> @CompileStatic
> trait ChildTrait extends ParentTrait {
>     void applyConfig(Closure closure, Object target) {
>         configure(closure, target)
>     }
> }
> @CompileStatic
> class Example implements ChildTrait {
> }
> {code}
> h2. Expected result
> The code should pass static type checking. A sub-trait should be able to 
> resolve a static method declared by a parent trait.
> h2. Actual result
> Static type checking fails on the call from the sub-trait body:
> {code}
> Cannot find matching method ChildTrait#configure(groovy.lang.Closure, 
> java.lang.Object)
> {code}
> Using a qualified call also fails:
> {code:groovy}
> ParentTrait.configure(closure, target)
> {code}
> h2. Real-world use case
> Apache Grails has the same pattern in the GraphQL DSL helper traits.
> Parent trait method:
> {code}
> grails-data-graphql/core/src/main/groovy/org/grails/gorm/graphql/entity/dsl/helpers/ExecutesClosures.groovy
> line 34
> {code}
> {code:groovy}
> @CompileStatic
> trait ExecutesClosures {
>     static void withDelegate(@DelegatesTo(strategy = Closure.DELEGATE_ONLY) 
> Closure closure, Object delegate) {
>         ...
>     }
> }
> {code}
> Sub-traits that should be able to call the inherited helper:
> {code}
> grails-data-graphql/core/src/main/groovy/org/grails/gorm/graphql/entity/dsl/helpers/Arguable.groovy
> grails-data-graphql/core/src/main/groovy/org/grails/gorm/graphql/entity/dsl/helpers/ComplexTyped.groovy
> {code}
> Grails currently works around this by inlining the parent trait helper body 
> into each sub-trait. Once this Groovy STC issue is fixed, that inline 
> workaround can be removed.
> h2. Workaround
> Inline the static helper body in each sub-trait, or avoid calling the 
> inherited static trait method from the sub-trait.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to