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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2789?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 67.2775%. Comparing base 
([`c93459b`](https://app.codecov.io/gh/apache/groovy/commit/c93459bca7c5d50c98bb5555e72c2363949faafd?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`2089b7c`](https://app.codecov.io/gh/apache/groovy/commit/2089b7c0ace249b3294a1c1a49ac8df48553d1c2?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 2 commits behind head on GROOVY_5_1_X.
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2789?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/2789?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/2789?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/2789/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/2789?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                  Coverage Diff                   @@
   ##             GROOVY_5_1_X      #2789        +/-   ##
   ======================================================
   + Coverage         67.2603%   67.2775%   +0.0172%     
   - Complexity          29611      29632        +21     
   ======================================================
     Files                1382       1383         +1     
     Lines              117084     117109        +25     
     Branches            20585      20596        +11     
   ======================================================
   + Hits                78751      78788        +37     
   + Misses              31786      31775        -11     
   + Partials             6547       6546         -1     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2789?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/2789?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 [2 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/2789/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