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

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

testlens-app[bot] commented on PR #3179:
URL: https://github.com/apache/groovy/pull/3179#issuecomment-7065145900

   ## 🚨 All tests passed but jobs failed 🚨
   
   ### Failed Jobs without Test Failures
   
   ❌ [jmh / 
summary](https://github.com/apache/groovy/actions/runs/44920635919/job/136896905885?pr=3179)
   
   🏷️ Commit: 682fcf57a979d9ff7d9beec9eddbd1a502280cba
   ▶️ Tests:  431 executed
   🟡 Checks: 19/26 completed
   
   ### Rerun Controls
   
   Click the checkbox to trigger a rerun:
   
   🔲 **Rerun jobs**
   
   ---
   _Learn more about TestLens at 
[testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
   




> Packed closures read and write owner properties as fields, skipping getters 
> and setters
> ---------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12658
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12658
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> A closure packed by closure packing (GEP-27, via {{@PackedClosures}} or 
> {{-Dgroovy.target.closure.pack=true}}) has its body moved into a method of 
> the owner class. There, a property of the owner compiles to direct field 
> access, so the getter and setter are no longer called. The closure class it 
> replaces calls them.
> {code:groovy}
> @groovy.transform.CompileStatic // or @groovy.transform.PackedClosures 
> without @CompileStatic
> @groovy.transform.PackedClosures
> class Box {
>     int gets, sets
>     BigDecimal e = 1
>     BigDecimal getE() { gets++; e }
>     void setE(BigDecimal v) { sets++; e = v }
>     def m() { def r = { -> e++ }(); [r, this.@e, gets, sets] }
> }
> println new Box().m()
> {code}
> *Actual:* {{[1, 2, 0, 0]}}
> *Expected:* {{[1, 2, 1, 1]}}, as without packing.
> The same happens for reads, assignments, compound assignments, prefix and 
> postfix forms, and both {{e}} and {{this.e}}. It also affects a subclass 
> override of a generated accessor, static properties, {{is}} getters, and 
> (dynamic) an owner that overrides {{getProperty}}. 
> {{AsmClassGenerator.visitPropertyExpression}} resolves {{this.name}} to the 
> declared field in any method of the class; the hoisted body is such a method, 
> so it bypasses the accessors.
> Verified on 6.0.0 and master.



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

Reply via email to