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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2788?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 `92.00000%` with `2 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 70.1181%. Comparing base 
([`142130d`](https://app.codecov.io/gh/apache/groovy/commit/142130d38010187a509466c9beafbcbd46fa6100?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`68cb0f3`](https://app.codecov.io/gh/apache/groovy/commit/68cb0f3f3f75a89f92c587eda086ac394e122ef8?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/2788?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[...ain/java/org/apache/groovy/runtime/ObjectUtil.java](https://app.codecov.io/gh/apache/groovy/pull/2788?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fruntime%2FObjectUtil.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9ydW50aW1lL09iamVjdFV0aWwuamF2YQ==)
 | 92.0000% | [1 Missing and 1 partial :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2788?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/2788/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/2788?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #2788        +/-   ##
   ==================================================
   + Coverage     70.1064%   70.1181%   +0.0117%     
   - Complexity      35774      35795        +21     
   ==================================================
     Files            1561       1562         +1     
     Lines          132373     132398        +25     
     Branches        24332      24343        +11     
   ==================================================
   + Hits            92802      92835        +33     
   + Misses          31170      31165         -5     
   + Partials         8401       8398         -3     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2788?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...ain/java/org/apache/groovy/runtime/ObjectUtil.java](https://app.codecov.io/gh/apache/groovy/pull/2788?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fruntime%2FObjectUtil.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9ydW50aW1lL09iamVjdFV0aWwuamF2YQ==)
 | `92.0000% <92.0000%> (ø)` | |
   
   ... and [7 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/2788/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>




> Groovy 4 @Immutable bytecode fails on Groovy 5 because ObjectUtil was removed
> -----------------------------------------------------------------------------
>
>                 Key: GROOVY-12257
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12257
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 5.0.8
>            Reporter: Mattias Reichel
>            Priority: Major
>
> h3. Summary
> A class compiled with Groovy 4 using @Immutable fails at runtime when 
> executed with Groovy 5.
> The Groovy 4 @Immutable AST transformation generates bytecode that calls:
> {code:java}
> org.apache.groovy.runtime.ObjectUtil.cloneObject(Object)
> {code}
> org.apache.groovy.runtime.ObjectUtil is present in Groovy 4 but was removed 
> in Groovy 5. Constructing an affected class therefore throws:
> {code:java}
> java.lang.NoClassDefFoundError: org/apache/groovy/runtime/ObjectUtil
> {code}
> h3. Reproducer
> A minimal Gradle reproducer is provided here: 
> https://github.com/matrei/groovy-immutable-compat. It compiles the class with 
> Groovy 4.0.33 and runs it with Groovy 5.0.8:
> {code:groovy}
> import groovy.transform.Immutable
> @Immutable
> class ImmutableValue {
>     List<String> values
> }
> println new ImmutableValue(['value'])
> {code}
> Run:
> {code:bash}
> ./gradlew reproduce
> {code}
> h3. Actual Behaviour
> Compilation succeeds with Groovy 4, but execution with Groovy 5 fails when 
> the immutable class is instantiated:
> {code:java}
> java.lang.NoClassDefFoundError: org/apache/groovy/runtime/ObjectUtil
> {code}
> h3. Expected Behaviour
> Groovy 4-compiled @Immutable classes should remain binary-compatible with 
> Groovy 5, or the Groovy 5 transformation/runtime should provide a 
> compatibility path for the generated bytecode.
> Recompiling the source with Groovy 5 avoids the problem, but this does not 
> help users consuming libraries or plugins distributed as Groovy 4-compiled 
> binaries.
> h3. Root Cause
> The Groovy 4 @Immutable transformation emits calls to 
> ObjectUtil.cloneObject(Object) for defensive copying of properties such as 
> collections. The referenced runtime class was removed in Groovy 5:
> {code:java}
> Groovy 4: org/apache/groovy/runtime/ObjectUtil.class is present
> Groovy 5: org/apache/groovy/runtime/ObjectUtil.class is absent
> {code}
> The failure is not detected during dependency resolution or application 
> startup. It occurs only when the affected immutable class is instantiated.



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

Reply via email to