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

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

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

   ## 🚨 Jobs failed without executing tests 🚨
   
   ### Failed Jobs without Test Failures
   
   ❌ [Check licenses / test 
\(ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/42469411111/job/128696450271?pr=3182)
   ❌ [Performance check / 
test](https://github.com/apache/groovy/actions/runs/42469411136/job/128696450626?pr=3182)
   ❌ [jmh / 
summary](https://github.com/apache/groovy/actions/runs/42469411138/job/128696568119?pr=3182)
   ❌ [jmh / test \(bench, 
\\\\.bench\\\\.\)](https://github.com/apache/groovy/actions/runs/42469411138/job/128696450728?pr=3182)
   ❌ [jmh / test \(core-ag, 
\\\\.perf\\\\.[A-G]\)](https://github.com/apache/groovy/actions/runs/42469411138/job/128696450710?pr=3182)
   ❌ [jmh / test \(core-hz, 
\\\\.perf\\\\.[H-Z]\)](https://github.com/apache/groovy/actions/runs/42469411138/job/128696450720?pr=3182)
   ❌ [jmh / test \(grails-ad, 
\\\\.perf\\\\.grails\\\\.[A-D]\)](https://github.com/apache/groovy/actions/runs/42469411138/job/128696450674?pr=3182)
   ❌ [jmh / test \(grails-ez, 
\\\\.perf\\\\.grails\\\\.[E-Z]\)](https://github.com/apache/groovy/actions/runs/42469411138/job/128696450545?pr=3182)
   ❌ [jmh-classic / test \(bench, 
\\\\.bench\\\\.\)](https://github.com/apache/groovy/actions/runs/42469411041/job/128696450172?pr=3182)
   ❌ [jmh-classic / test \(core-ag, 
\\\\.perf\\\\.[A-G]\)](https://github.com/apache/groovy/actions/runs/42469411041/job/128696450175?pr=3182)
   ❌ [jmh-classic / test \(grails-ad, 
\\\\.perf\\\\.grails\\\\.[A-D]\)](https://github.com/apache/groovy/actions/runs/42469411041/job/128696449933?pr=3182)
   ❌ [jmh-classic / test \(grails-ez, 
\\\\.perf\\\\.grails\\\\.[E-Z]\)](https://github.com/apache/groovy/actions/runs/42469411041/job/128696450105?pr=3182)
   
   🏷️ Commit: 7dffc862b7c5d9189937efff42c1fe630121b395
   ▶️ Tests:  0 executed
   🟡 Checks: 14/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/)._
   




> A @PackedClosures closure silently ignores the delegate, owner and thisObject 
> passed to rehydrate instead of failing fast like setDelegate
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12661
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12661
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> With {{@PackedClosures}} under dynamic compilation, 
> {{PackedClosure.setDelegate}} refuses a delegate other than the owner, 
> because the hoisted body binds its free names to the owner at compile time. 
> {{Closure.rehydrate}} writes the delegate, owner and thisObject fields on the 
> copy directly, so it bypasses that guard. The packed body keeps calling the 
> original owner, and the new delegate or owner is silently ignored.
> {code:groovy}
> class D { String foo() { 'delegate' } }
> @groovy.transform.PackedClosures
> class O {
>     String foo() { 'owner' }
>     def m(D d) {
>         def c = { -> foo() }
>         println c.rehydrate(d, d, d)()
>         println c.rehydrate(d, this, this).delegate == d
>         c.delegate = d
>     }
> }
> new O().m(new D())
> {code}
> *Actual:* prints {{owner}} and {{true}}, then the last line throws 
> UnsupportedOperationException ("Cannot set a delegate on a @PackedClosures 
> closure ..."). Rehydrating onto another owner of the same class also returns 
> the original owner's result.
> *Expected:* rehydrate refuses a delegate, owner or this object the packed 
> body cannot honour, with the same UnsupportedOperationException as 
> setDelegate. Without the annotation the closure prints {{delegate}}.
> Cause: PackedClosure guards setDelegate and setResolveStrategy but not 
> rehydrate, which sets the fields without calling setDelegate.
> Verified on 6.0.0 and master.



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

Reply via email to