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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2537?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 `88.17204%` with `11 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 68.1861%. Comparing base 
([`1b70ef4`](https://app.codecov.io/gh/apache/groovy/commit/1b70ef49a30627c62375c24cfe60e4db03361a44?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`b187567`](https://app.codecov.io/gh/apache/groovy/commit/b187567c556f5bb9fe218596b9406d7a8206142b?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 4 commits behind head on master.
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2537?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/copywith/NestedCopyWithSupport.java](https://app.codecov.io/gh/apache/groovy/pull/2537?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Ftransform%2Fcopywith%2FNestedCopyWithSupport.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS90cmFuc2Zvcm0vY29weXdpdGgvTmVzdGVkQ29weVdpdGhTdXBwb3J0LmphdmE=)
 | 87.1795% | [1 Missing and 4 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2537?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   | 
[...he/groovy/transform/copywith/CopyWithRecorder.java](https://app.codecov.io/gh/apache/groovy/pull/2537?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Ftransform%2Fcopywith%2FCopyWithRecorder.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS90cmFuc2Zvcm0vY29weXdpdGgvQ29weVdpdGhSZWNvcmRlci5qYXZh)
 | 80.0000% | [1 Missing and 3 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2537?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   | 
[...ava/org/apache/groovy/ast/tools/CopyWithUtils.java](https://app.codecov.io/gh/apache/groovy/pull/2537?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fast%2Ftools%2FCopyWithUtils.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9hc3QvdG9vbHMvQ29weVdpdGhVdGlscy5qYXZh)
 | 93.3333% | [0 Missing and 1 partial :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2537?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   | 
[...y/transform/RecordCompletionASTTransformation.java](https://app.codecov.io/gh/apache/groovy/pull/2537?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2FRecordCompletionASTTransformation.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9SZWNvcmRDb21wbGV0aW9uQVNUVHJhbnNmb3JtYXRpb24uamF2YQ==)
 | 50.0000% | [0 Missing and 1 partial :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2537?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/2537/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/2537?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #2537        +/-   ##
   ==================================================
   + Coverage     68.1651%   68.1861%   +0.0209%     
   - Complexity      32860      32888        +28     
   ==================================================
     Files            1499       1502         +3     
     Lines          125394     125486        +92     
     Branches        22665      22680        +15     
   ==================================================
   + Hits            85475      85564        +89     
   + Misses          32399      32398         -1     
   - Partials         7520       7524         +4     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2537?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...s/groovy/transform/ImmutableASTTransformation.java](https://app.codecov.io/gh/apache/groovy/pull/2537?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2FImmutableASTTransformation.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9JbW11dGFibGVBU1RUcmFuc2Zvcm1hdGlvbi5qYXZh)
 | `67.3367% <100.0000%> (+0.4999%)` | :arrow_up: |
   | 
[.../groovy/transform/RecordTypeASTTransformation.java](https://app.codecov.io/gh/apache/groovy/pull/2537?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2FRecordTypeASTTransformation.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9SZWNvcmRUeXBlQVNUVHJhbnNmb3JtYXRpb24uamF2YQ==)
 | `84.7973% <100.0000%> (+0.6984%)` | :arrow_up: |
   | 
[...ava/org/apache/groovy/ast/tools/CopyWithUtils.java](https://app.codecov.io/gh/apache/groovy/pull/2537?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fast%2Ftools%2FCopyWithUtils.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9hc3QvdG9vbHMvQ29weVdpdGhVdGlscy5qYXZh)
 | `93.3333% <93.3333%> (ø)` | |
   | 
[...y/transform/RecordCompletionASTTransformation.java](https://app.codecov.io/gh/apache/groovy/pull/2537?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2FRecordCompletionASTTransformation.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9SZWNvcmRDb21wbGV0aW9uQVNUVHJhbnNmb3JtYXRpb24uamF2YQ==)
 | `78.5714% <50.0000%> (-2.1978%)` | :arrow_down: |
   | 
[...he/groovy/transform/copywith/CopyWithRecorder.java](https://app.codecov.io/gh/apache/groovy/pull/2537?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Ftransform%2Fcopywith%2FCopyWithRecorder.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS90cmFuc2Zvcm0vY29weXdpdGgvQ29weVdpdGhSZWNvcmRlci5qYXZh)
 | `80.0000% <80.0000%> (ø)` | |
   | 
[...oovy/transform/copywith/NestedCopyWithSupport.java](https://app.codecov.io/gh/apache/groovy/pull/2537?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Ftransform%2Fcopywith%2FNestedCopyWithSupport.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS90cmFuc2Zvcm0vY29weXdpdGgvTmVzdGVkQ29weVdpdGhTdXBwb3J0LmphdmE=)
 | `87.1795% <87.1795%> (ø)` | |
   
   ... and [7 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/2537/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>




> Provide a nested copyWith capability
> ------------------------------------
>
>                 Key: GROOVY-12015
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12015
>             Project: Groovy
>          Issue Type: New Feature
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>
> h3. Summary
> Extends {{copyWith}} (generated for {{@Immutable}} and {{@RecordType}}
> classes declared with {{{}copyWith=true{}}}) with nested-path support and a
> transactional block form, for ergonomic updates of immutable object graphs.
> h3. Nested-path map form
> A {{copyWith}} key may now be a dotted path; the affected nested nodes are
> rebuilt recursively and untouched branches are reused.
> {code:groovy}
> def q = p.copyWith('address.city': 'NYC', 'address.zip': '10001')
> {code}
>  * Works for arbitrarily deep paths and heterogeneous {{{}@Immutable{}}}/
> {{@RecordType}} graphs (record-in-record included).
>  * Plain (non-dotted) keys behave exactly as before.
>  * Identity is preserved transitively: if nothing changes, the original
> instance is returned.
>  * Every node on a nested path must itself provide {{{}copyWith(Map){}}};
> otherwise a clear, specific error is raised.
> h3. Transactional block form
> A {{copyWith(Closure)}} overload is also generated:
> {code:groovy}
> def q = p.copyWith {
>     name = 'Bob'                                 // plain set
>     address.city = old.address.city.reverse()    // derive from the original
>     fullName = old.first + ' ' + old.last        // cross-field derivation
>     loginCount.modify { it + 1 }                 // single-field shorthand
> }
> {code}
>  * {{old}} resolves to the original (pre-state) object, consistent with
> {{old}} in {{{}@Ensures{}}}/{{{}@Contract{}}}, and may be used to derive any 
> new
> value, including across fields.
>  * {{prop.modify\{ \} }} is a shorthand for the common 
> transform-this-same-field case.
>  * To invoke a real same-named {{modify}} method on a value type (or simply 
> for readability), use the {{old}} form: x = old.x.modify { ... \}.
>  * An empty or no-op block returns the original instance.
> h3. Compatibility
>  * A no-arg {{copyWith()}} is generated, returning the same instance
> (preserving the historical zero-argument behaviour).
>  * Existing single-level and Map-based {{copyWith}} usage is unchanged.
>  * Shared generation logic is used by both the {{@Immutable}} and
> {{@RecordType}} transforms so behaviour stays identical across the two.



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

Reply via email to