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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3258?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 74.4007%. Comparing base 
([`d020012`](https://app.codecov.io/gh/apache/groovy/commit/d02001286af335c8777fb9f5770e48ec4d07119f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`cfcbc70`](https://app.codecov.io/gh/apache/groovy/commit/cfcbc70f64b93ca2beda95a7c196b8d64996c423?dropdown=coverage&el=desc&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/3258/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/3258?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3258        +/-   ##
   ==================================================
   - Coverage     74.4010%   74.4007%   -0.0003%     
   - Complexity      44345      44346         +1     
   ==================================================
     Files            1699       1699                
     Lines          150998     151000         +2     
     Branches        28770      28771         +1     
   ==================================================
   + Hits           112344     112345         +1     
   + Misses          28380      28379         -1     
   - Partials        10274      10276         +2     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3258?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...roovy/contracts/ast/ModifiesASTTransformation.java](https://app.codecov.io/gh/apache/groovy/pull/3258?src=pr&el=tree&filepath=subprojects%2Fgroovy-contracts%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fcontracts%2Fast%2FModifiesASTTransformation.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LWNvbnRyYWN0cy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ3Jvb3Z5L2NvbnRyYWN0cy9hc3QvTW9kaWZpZXNBU1RUcmFuc2Zvcm1hdGlvbi5qYXZh)
 | `72.0588% <100.0000%> (+0.8467%)` | :arrow_up: |
   
   ... and [9 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3258/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>




> @Modifies with a value that is not a closure is silently an empty frame, 
> which ModifiesChecker then reports as violated
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12723
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12723
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> {{ModifiesASTTransformation}} rejects a bare {{@Modifies}} ("@Modifies 
> requires a closure listing the modifiable targets; use @Modifies({}) to 
> declare that nothing is modified") but accepts any other value that is not a 
> closure in silence: {{extractFromAnnotation}} returns when the member is not 
> a {{ClosureExpression}}, the frame stays empty, and {{visit}} then replaces 
> the member with a class reference, so the annotation verifier never sees the 
> original value either. With {{ModifiesChecker}} on, the method is checked 
> against that empty frame:
> {code:groovy}
> import groovy.contracts.Modifies
> import groovy.transform.CompileStatic
> @CompileStatic(extensions = 'groovy.typecheckers.ModifiesChecker')
> class Inventory {
>     int stock = 0
>     List<String> log = []
>     @Modifies(['this.stock', 'this.log'])
>     void restock(int amount) {
>         stock += amount
>         log.add('restock ' + amount)
>     }
> }
> {code}
> {noformat}
> [Static type checking] - @Modifies violation: assignment to 'stock' but 
> 'stock' is not declared in @Modifies
> {noformat}
> The message says the opposite of what the source says, and without the 
> checker the class compiles with a frame that declares nothing. Expected: the 
> error a bare {{@Modifies}} gets, at the annotation, naming what was found.
> A list of strings is the first thing a language model writes for this 
> annotation (three of three runs, with the contracts documentation summarised 
> in front of it, in the seventh live run of the groovyai eval). The fix is one 
> condition in {{visit}}: a value that is not a {{ClosureExpression}} gets the 
> existing message plus "; found ['this.stock', 'this.log']".



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

Reply via email to